My ASP.NET Ajax page has a LinkButton under the UpdatePanel. When clicking the link button, another web page test.aspx will pop up in a new window.
I used Eilon's ScriptManagerHelper class to register the javascript aiming to open a new window. Here is the event handler when clicking on the link button:
The new window cannot be opened. If just using “window.open();”, it cannot be opened either. Both of them have this error: There is no source code available for the current location. Any comments about this error? Thanks.
LSU.Net
Contributor
2479 Points
467 Posts
Re: HOWTO: Write controls compatible with UpdatePanel without linking to the ASP.NET AJAX DLL
Mar 26, 2007 02:15 PM|LINK
Alhambraeidos,
Hay dos funcciones que tienen el mismo nombre. Necesita usted usar ese sintactico:
Type scriptManagerType = Type.GetType("System.Web.UI.ScriptManager, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", false); if (scriptManagerType != null) { //ScriptManager.RegisterClientScriptResource(Control, Type, string); RegisterClientScriptResourceMethod = scriptManagerType.GetMethod("RegisterClientScriptResource", new Type[] { typeof(Control), typeof(Type), typeof(System.String)}); }Please remember to "mark as answered" posts that have helped you.
-----
http://lsudotnet.blogspot.com
stock
Member
3 Points
11 Posts
Re: HOWTO: Write controls compatible with UpdatePanel without linking to the ASP.NET AJAX DLL
Oct 25, 2007 08:46 PM|LINK
My ASP.NET Ajax page has a LinkButton under the UpdatePanel. When clicking the link button, another web page test.aspx will pop up in a new window. I used Eilon's ScriptManagerHelper class to register the javascript aiming to open a new window. Here is the event handler when clicking on the link button:
protected void lbutton_Click(object sender, EventArgs e)
{
System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
{
strBuilder.Append("<script language='javascript'>");
strBuilder.Append("x=0; y=0; if(screen){x=(screen.availWidth - 900)/2; y = (screen.availHeight - 700)/2;}");
strBuilder.Append("window.open('" + "../forms/test.aspx" + "', 'CustomPopUp', ");
strBuilder.Append("'width=900, height=600, left='+x+',top='+y+',screenX='+x+',screenY='+y+',menubar=yes, scrollbars=yes, status=yes, resizable=yes')");
strBuilder.Append("</script>");
}
ScriptManagerHelper.RegisterStartupScript(this, this.GetType(), "PopupScript", strBuilder.ToString(), true);
}
The new window cannot be opened. If just using “window.open();”, it cannot be opened either. Both of them have this error: There is no source code available for the current location. Any comments about this error? Thanks.
PC