473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Page.ClientScript.RegisterStartupScript Not Working In Update Panel

I using following script in my project. Once click the button and there will open a pop up window. But "Page.ClientScript.RegisterStartupScript" script seem NOT working in update panel. After remove Update panel and it is working properly. Any solution?
Expand|Select|Wrap|Line Numbers
  1. Page.ClientScript.RegisterStartupScript(Me.GetType(), "openpopup", "window.open('" & "child.aspx" & "','ChildWindow','height = 520, width = 730,status=no,location=no,directories=no, resizable = 1, scrollbars=yes, left=75, top=75')", True)
Apr 7 '08 #1
9 42627
Instead of using RegisterStartupScript use this Page.ClientScript.RegisterClientScriptBlock(argume nts) because RegisterStartupScript call the javascript before initallizing the DOM object while
RegisterClientScriptBlock call after the page DOM objects initialized. May this was the issue ... if not then tell ...
Apr 7 '08 #2
Sorry, is not working. Any other solution? Ur help will be appreciate.
Apr 8 '08 #3
I found out the issue about my problem, seem the Page.ClientScript.RegisterStartupScript() not working when included Master page. Any solution?
Apr 8 '08 #4
Can u post the code here or related code here ?
Apr 8 '08 #5
finally i found out the problem, cause i'm using master page in my project, so the page will load twice. If i remove the master page, then it will load1 times. For the below mentioned script is working fine, but once i included master page for the below mentioned script, then it failed to run the script.Any method or solution to prevent master page load twice?

'working fine & properly without master page
Protected Sub OpenWindowWithUpdatePanel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim url2 As String
url2 = "ChildWindow.aspx"

ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "openpopup", "window.open('" & url2 & "','OpenChildWindowUsingUpdatePanel','height = 520, width = 730,status=no,location=no,directories=no, resizable = 1, scrollbars=yes, left=75, top=75');", True)


End Sub




Regards
Seng
Apr 9 '08 #6
finally i get the solution and solved my issue. The script ScriptManager.RegisterClientScriptBlock() only working in .aspx and not working on .ascx. Anywhere thx for your help.
Apr 9 '08 #7
in the updatepanel use ScriptManager.RegisterStartupScript Method..
Apr 2 '10 #8
ZORBA
1
it works in the ascx but the problem is for example you are passing this as an argument for the function example
ScriptManager.RegisterStartupScript(this, typeof(Page), "OpenWindow","alert('1'), "true);

try instead passing a control that is inside the updatepanel example
ScriptManager.RegisterStartupScript(GridView1, typeof(Page), "OpenWindow","alert('1'), "true);
Apr 6 '10 #9
use the following code it will dafinatley work
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "alert('" "')", true);
Aug 26 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
4
by: Jon Paal | last post by:
"Page.Clientscript" does not compile in assembly, with the error message "Reference to a non-shared member requires an object reference". ... what reference is it looking for ?????? class...
2
by: rodchar | last post by:
hey all, how can i get javascript procedure to execute as the very last thing before the page is rendered? Background: I have a DIV element inside an update panel. I am setting the scrollLeft...
1
by: HockeyFan | last post by:
My function to get an alert box on the page isn't working. Instead it puts in the bottom section of the page: <script type="text/javascript"> <!-- This is a test// --> </script> The...
8
by: BiffMaGriff | last post by:
Hello, I am using VS2005 to code webapps using C#. I am trying to call the javascript function alert() from my codebehind. I am using master pages and AJAX. My page structure is as follows: ...
0
by: =?Utf-8?B?QW50b25pbw==?= | last post by:
Hello, everyone. I am trying to open a popup page to display some information but it is not working. Going through the code, no errors are generated. It goes to the end of the code but it does...
2
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a...
4
by: BiffMaGriff | last post by:
Hello, I have a GridView that I put inside an update panel. I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the...
1
by: anudu | last post by:
Hi, I have several update panels in my page. i want to call different javascript methods after the update panels are refreshed . i have attached the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.