473,383 Members | 1,870 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,383 software developers and data experts.

Getting error message as "Script controls may not be registered before PreRender."

Hi

I am creating a usercontrol in .net and using that as webpart in sharepoint site. i want to make use of ajax in my user control. and hence i added scriptmanager, updatepannel and update progress controls on to my ascx page.

on output of the page, i am getting the error message as ......"Script controls may not be registered before PreRender."i need the solution for this error.

i tested this ajax functionality on local website with aspx page and is working fine.

please help me out in getting solution.

thanks in advance.

Raj
Jun 4 '09 #1
7 11850
Frinavale
9,735 Expert Mod 8TB
@rajkumarbathula
Are you manually registering script controls?
If so, where in the page life cycle are you doing this?

You should probably be using a ScriptManagerProxy instead of a ScriptManager in user controls. Usually ScriptManagers are included in the aspx page so that they are available to all controls in the page (or even a MasterPage which makes them available to all pages that use the MasterPage). You can only have one ScriptManager at a time on a page, so your UserControl might break this.
Jun 4 '09 #3
Thanks Frina.

yes what u gueesed is correct. i am using script manager in my user control. as of now my aspx page contains only 1 user control and my masterpage is not containing any scriptmanager and hence totally there is 1 scriptmanager at the time of rendering my webpart.

suprisingly, i am getting this error only if i use <updateprogress> tage. if i am not using this, i am not getting this error.

so i removed it and tested, for first time the ajax functionality is working. ie., on click on a button, without postback i got my results. but from then onwards ajax is not working. i mean no functionality is happening on my page like when i click button again for another results, i am not getting that. i debugged the process and i found from second time click, the page is not getting loaded...

dont know y??

please give me any best solution. so tell me what i have to use instead of scriptmanager. in my ajax tool box, i didnt find the control that you said.

plz explain clearly what i have to do.

thanks in advance

regards
Raj
Jun 5 '09 #4
Frinavale
9,735 Expert Mod 8TB
Here's more information about the ScriptManagerProxy. You should be able to find it in the ToolBox under the Ajax Extensions section.

Although using the ScriptManagerProxy is probably a good idea, it's not what's causing your problem.

When you say:
@rajkumarbathula
You're not entirely correct. A postback does occur. It occurs asynchronously (The "A" in Ajax stands for Asynchronous).

So this means that a postback/call to the server occurs (and since you're using an update panel the entire ASP.NET page life cycle happens) but when the response is returned to the browser only a portion of the page is updated. This lets you make multiple calls to the server from different parts of the page without having to send the whole page to the server.


So, what I recommend is that you place a breakpoint on your Page Load event and see if a post back reaches the server the second click.....

If it doesn't get there then we know that something's messing up client side.
If it does get there then we know that something's messing up server side.
Jun 5 '09 #5
hi frinavale

i am very much happy to see ur last lines ie.,

@Frinavale
i kept a breakpoint on page load and also at button click event on server side. and when i click button for first time page load is happening.

but when i click button for second time, page load is not getting triggered. so according to this, and to your point, hope there is something wrong in client side.

plz tell me what might be the issue for this...?

thanks a lot for ur solutions..

Regards
Raj
Jun 9 '09 #6
hi frinavale

my problem was solved by adding 2 script lines in my ascx page.

and those lines are..
Expand|Select|Wrap|Line Numbers
  1. <script type='text/javascript'>   
  2.   _spOriginalFormAction = document.forms[0].action;   
  3.   _spSuppressFormOnSubmitWrapper=true;   
  4. </script> 
this solved my issue of postback on any number of time clicks on button.

but another problem occured when i tried the same on another system..

it is..i placed a text box and button on a ascx and i implemented ajax. every thing is working fine and even my code behind is also executing on button click. but the lines in my button click event ie., assign static text to textbox is of not affecting any thing.

after the execution of code behind, i am not getting any output. i am getting the same old page when it was loaded before button click.

even after execution of my code behind dont know why it is not refelecting in my page.

plz save me.......
Jun 9 '09 #7
Frinavale
9,735 Expert Mod 8TB
I'm glad you solved your original problem!
You should post a new thread for your new question but I have a feeling that you are setting the text again after the button click event...you may be setting this in your PreRender event or another event that occurs after the button click event in the asp.net page life cycle.
Jun 15 '09 #8

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

Similar topics

0
by: clare_5342 | last post by:
Has anyone run into this situation and could possibly help me out? I am running on w2k vf mssql Description: Error: Script Engine Exception. A ScriptEngine threw expectio 'C0000005' in...
5
by: Rick | last post by:
I wrote the following code as part of a page where users can reorder a list of items by highlighting an item in a list box and clicking an "up" or "down" button to move the items around. The code...
1
by: Yoav | last post by:
I am using os.popen3 to call a console process and get its output and stderr. However on Win32 (and not OS X) I also get the Errno message. It's printed to the screen, which I wish to keep clean....
10
by: jaire | last post by:
In my application I have two threads. Each of them creates a new propertygrid. In the property grid I have a property with a color editor. Whenever i am clicking on the combo box to change the...
0
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When...
0
by: joef | last post by:
I'm running VS.net on my PC (W2K) connected to a remote IIS server (W2K) SP4 that is not a domain controller. I've got the ASPNET and IWAM accounts in the "Impersonate a client after...
1
by: Flack | last post by:
Hey guys, Here is whats happening. I have a StringBuilder, a TextBox, and a TabControl with one TabPage. On my main form, I created and displayed a fairly big maze. While the app is solving...
0
by: jonny | last post by:
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. ...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.