Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegisterStartUpScript() Not Working After Adding AJAX UpdatePanel (VB.Net)

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
Hello,

I had a working web site, but wanted to add a ProgressBar to it. After much trial-and-error, I finally decided to try using the Ajax UpdatePanel on it to handle the ProgressBar.

Previously the ScriptManager.RegisterStartupScript() was working just fine.
Once I added the Ajax Updatepanel, it quit working.

I see a variety of other postings on other websites about this problem, but there does not seem to be a definitive solution.
Some people tried one thing and it worked, but did not work for others, etc.
I tried a number of "throw it on the wall to see if it sticks" approaches, but they too did not work.

What used to work and successfully launched 'startup' javascript:
ScriptManager.RegisterStartupScript(Me.Page, Page.GetType, "MyStartUpJavaScript", "startUpScript()", True)

Any suggestions/advice would be greatly appreciated.

Thanks,
JRB-Bldr

 
I forgot to add that I want the StartUp javascript to execute when the Whole Page executes.

I don't see that this StartUp javascript should need to execute when the UpdatePanel refreshes (every one second after being 'Triggered') - since that only displays the ProgressBar and not the other form objects which the startup javascript 'manipulates'.

Since I don't know if that may or may not be pertinent to the issue, I thought that I'd throw it in.

Thanks,
JRB-Bldr

 
I MAY have found the answer even though I am not sure why.

By changing the syntax to:
ScriptManager.RegisterClientScriptBlock(TryCast(sender, Control), Me.GetType(), Guid.NewGuid().ToString(), "startUpScript()", True)

It is now launching the intended javascript - startUpScript()

I now have another issue related to that, but I will post it in a javascript area of the forum.

Thanks,
JRB-Bldr
 
Please forget what I said above about a 'new' problem.

Actually my primary problem stated here, while seeming to be resolved, was really not.

So let me restate my problem in a hopefully more clear manner.

I have an ASP.Net webpage that used to work just fine.
That code had in it a working javascript StartUpScript that I launched with a:
Code:
[b]ScriptManager.RegisterStartupScript(Me.Page, Page.GetType(), Guid.NewGuid().ToString(), "startUpScript()", True)[/b]

But I wanted to add a ProgressBar to the back-end table updates that are launched with a Button Click (not a SUBMIT button).
After trying a number of things, I finally decided to try AJAX and their approach to a ProgressBar using an UpdatePanel.

I followed a rather clearly presented approach and put that code in place - and from a methodology approach it looks as though it might really work.

But when I first launched the code, I saw that my javascript StartUpScript was not executing - Firebug was not breaking at my intended javascript Function

It appeared that AJAX was creating its own javascript and that it was running instead of mine.

Point of reference, when I first launch the page the AJAX javascript seems to run and I never see my javascript code run.
However if I do a manual Page Refresh through the browser control, my javascript StartUpScript seems to be launched, but it cannot 'see' any of the form objects that I need.

From web readings that I have done ALL DAY, I am guessing that one of the javascript code launches is for the AJAX UpdatePanel load and the other javascript code launch is for the over-all form. But I cannot tell which is which and what code it SHOULD be running at launch.

What more information can I offer to help you assist me in finding the answer?

As before, any advice/suggestions you might have would be greatly appreciated.

Thanks,
JRB-Bldr



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top