|
i have to get left position of the panel on pageload. i do get dat by playing a trick, but wt problem now i face is im not able to put dat value in the hidden control. below is code that i use for the purpose:
string strJS = @" <script language='javascript' type='text/javascript'> intWidth = document.body.clientWidth;intHeight = document.body.clientHeight;intWidth = (intWidth* 15/100);document.getElementById('<% =HpnlCtrlLeftPos.ClientID %>').value=intWidth; alert('Width : '+ intWidth +' Height : ' + intHeight); </script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ScreenPosition", strJS);
it throws exception
can any body help me............
|
|
|
|
|
The exception thrown might help to solve the problem...
|
|
|
|
|
S_Aijaz1 wrote: string strJS = @" intWidth = document.body.clientWidth;intHeight = document.body.clientHeight;intWidth = (intWidth* 15/100);document.getElementById('<% =HpnlCtrlLeftPos.ClientID %>').value=intWidth; alert('Width : '+ intWidth +' Height : ' + intHeight); ";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ScreenPosition", strJS);
Try this,
string strJS = @" intWidth = document.body.clientWidth;intHeight = document.body.clientHeight;intWidth = (intWidth* 15/100);document.getElementById('<% =HpnlCtrlLeftPos.ClientID %>').value=intWidth; alert('Width : '+ intWidth +' Height : ' + intHeight); ";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ScreenPosition", strJS, true);
if this doesn't help, post the error message you getting.
|
|
|
|
|
thank you sir, i have have tried dis as well but it is not working, at page load it does nt find the hidden control
|
|
|
|
|
I am working on a web application and newly entered in the developement field.
I need your help in the completion of this application.I want complete code behind the
login page means what will be classes we will have to declare,Integration with master page,
Navigation and creating,access to db.
Thanks
|
|
|
|
|
Did you searched on google, you'll find many examples if you spend just 5 minutes for searching it.
|
|
|
|
|
one of my site is running online.I want to configure my online sql server database for application services.I know to do it locally but dont know how to do online.i did following steps:
>i selected configure sql server for application services.
>give database name and selected sql server authentication mode,give username and password
>but it does not show the list of database n shows error:
"failed to query list of database name from sqlserver.login failed for user.
the user is not associated with trusted sql server connection."
Tell me what to do n where m i wrong....thank's
|
|
|
|
|
I think this is the permission issue. Does your server is installed in a Mixed mode.. I mean can you connect with the same user from the Management Console ?
Check this :
http://support.microsoft.com/kb/889615
|
|
|
|
|
dont know....
what requirement are needed to view the list of database...
when same username and password on in management studio it shows the list of databases...
|
|
|
|
|
Hello,
I would like access the shortcuts and its properties which is present in a client machine's directory (Desktop). How can I implement this with asp.net. Any hints would be appreciated.
Thanks for the help
Sebastian
|
|
|
|
|
No way.. places like Desktop or any client folder location is not accessible through HTML from the browser program because of security purpose.
Otherwise there will be a severe Security issue...
|
|
|
|
|
R u trying to hack someting.
|
|
|
|
|
|
So, you want to execute some exe from Client System ?
You can use ActiveX for that. But that will work only on IE.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
when you are using shopping cart website if any customers selects any thing from website and when he click add to cart and then buy then how to write the code
|
|
|
|
|
|
Suppose they are two button on the form. one with english and anothe with arabic.
when i click on arabic yhe whole web site should be in arabic. and when i click on english whole website should be on english..
|
|
|
|
|
Use PreRender to set
CurrentThread.CurrentCulture = new CultureInfo("yourculturekey");
And always use Resourcekey to show any text in the web page.
Check this :
Creating multilingual websites - Part 1[^]
I hope this is what you like.
|
|
|
|
|
Hi,
i am inheriting a masterpage in an aspx page. in the masterpage i am using updatepanel control.
now in the codebehind of that aspx page, when i complete the databasetransaction process, i want to display an alert box. But that alert box is not getting displayed as i am using updatepanel control.
prior to using updatepanelcontrol it was working as i use to display the alert box using httpcontext.current.response.write.
now as i am using updatepanelcontrol the alert box is not getting displayed by using registerscriptblock also.
Sandeep Kumbhar
|
|
|
|
|
i think this will help you[link]
|
|
|
|
|
Handle end request event of the update panel as following will may help you
1. Get instance of PageRequestManager
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
2. Callback function:
function endRequestHandler(sender, eventArgs)
{
if (eventArgs.get_error() != undefined && eventArgs.get_error().httpStatusCode == '500')
{
var error Message = eventArgs.get_error().message;
eventArgs.set_errorHandler(true);
alert(errorMessage);
} else
{
//alert($get("hidField").value);
}
}
|
|
|
|
|
Always use ScriptManager.RegisterStartupScript in case of Update panel rather than using ClientScript .
do like this :
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('hi');", true);
|
|
|
|
|
hi,
indeed this was a very good solution.
now i making this thing generic. so that i only have to call the msgpopup class and display the message. i am calling the dll of the project where i am writing the same code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('hi');", true);
but this seems to be not working. it fails to display the message box.
following is the code in the dll.
the code:--
==========
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections;
using System.Text;
using System.Web.UI;
/// <summary>
/// Summary description for MsgPopUp
/// </summary>
public class MsgPopUp
{
protected static Hashtable handlerPages = new Hashtable();
public static void Show(string Message)
{
try
{
if (!(handlerPages.Contains(HttpContext.Current.Handler)))
{
Page currentPage = (Page)HttpContext.Current.Handler;
if (!((currentPage == null)))
{
Queue messageQueue = new Queue();
messageQueue.Enqueue(Message);
handlerPages.Add(HttpContext.Current.Handler, messageQueue);
currentPage.Unload += new EventHandler(CurrentPageUnload);
}
}
else
{
Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));
queue.Enqueue(Message);
}
}
catch (Exception ex)
{
throw ex;
}
}
private static void CurrentPageUnload(object sender, EventArgs e)
{
try
{
Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));
if (queue != null)
{
StringBuilder builder = new StringBuilder();
int iMsgCount = queue.Count;
builder.Append("<script language='javascript'>");
string sMsg;
while ((iMsgCount > 0))
{
iMsgCount = iMsgCount - 1;
sMsg = System.Convert.ToString(queue.Dequeue());
sMsg = sMsg.Replace("\"", "'");
builder.Append("alert( \"" + sMsg + "\" );");
}
builder.Append("</script>");
handlerPages.Remove(HttpContext.Current.Handler);
//HttpContext.Current.Response.Write(builder.ToString());
Page currentPage = (Page)HttpContext.Current.Handler;
ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), Guid.NewGuid().ToString(), "alert('from baseengine')", true);
//if (!script.IsClientScriptBlockRegistered(script.GetType(), "Alert"))
//{
// script.RegisterClientScriptBlock(script.GetType(), "Alert", "alert('record inserted');", false);
//}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
Sandeep Kumbhar
modified on Wednesday, December 30, 2009 7:12 AM
|
|
|
|
|
Trying to build a SOAP web service using complex types and hit a road block. I am using VS to create a web reference to the SOAP service. ASP.NET 2.0, C#.
Getting the following error on the client:
System.NullReferenceException: Object reference not set to an instance of an object.
On the line setting the name on the SOAP client below, info.Organization.Name = "Test Org";
Here is what I have so far:
SOAP Web Service
[WebMethod]
public string CoverageRequest(RequestorInformation info)
{
return info.Organization.Name;
}
public class RequestorInformation
{
public Organization Organization;
}
public class Organization
{
public Organization() {}
private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
}
SOAP Client
VerifyInsurance.RequestorInformation info = new VerifyInsurance.RequestorInformation();
info.Organization.Name = "Test Org";
VerifyInsurance verify = new VerifyInsurance();
verify.CoverageRequest(info);
|
|
|
|
|
The Organization present in the object info is null.
Try this
VerifyInsurance.RequestorInformation info = new VerifyInsurance.RequestorInformation();
info.Organization = new Organization();
info.Organization.Name = "Test Org";
VerifyInsurance verify = new VerifyInsurance();
verify.CoverageRequest(info);
This should work.
|
|
|
|