Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 22, 2012 10:57 PM by markfitzme
Feb 21, 2012 06:50 PM|LINK
I am using Ajax to establish if the client browser supports HTML5 and put this information in a session variable for use during the session. Necessarily, I am writing the code programmatically, not declaratively.
In my simple test page, which works successully, the html generated for the hidden button is:
<input type="submit" name="btn1" value="Update" id="btn1" style="display:none;" />
Using exactly the same code in my production page, which uses a master page and a wizard, it doesn't work. The html generated for the hidden button is:
<input type="submit" name="ctl00$Main$btn1" value="Update" onclick="break;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Main$btnAjaxData", "", true, "", "", false, false))" id="ctl00_Main_btn1" style="display:none;" />
The same as in the test page except for the addition of the onclick attribute.
If this is not the cause, how do I fix this problem?
Your help would be much appreciated.
Thanking you in anticipation.
Feb 21, 2012 06:59 PM|LINK
Feb 22, 2012 10:46 PM|LINK
Thanks for your reply.
If I use the WebForm_DoPostBackWithOptions() function to make the call, the hidden control loses its value during the postback and i cannot fathom why.
Why is the onclick function generated in my production code. It is not generated in the test code and that works successfully. How to I inhibit the generation of the WebForm_DoPostBackWithOptions() function in the programmatically generated button control?
Much appreciate your help.
Feb 22, 2012 10:57 PM|LINK
Is there absolutely anything different between the deployed masterpage and non deployed? It looks though that the input control that is giving errors has the runat="server" attribute set on it. If that's the case then it would be generating calles to WebForm_DoPostBackWithOptions.
Another giveaway though is the fact that the ID of the contorl is: ctl00_Main_btn1 and the name: ctl00$Main$btn1. This would lead me to believe it has runat="server" on it because those id's are the standard format for a server control generating a unique
id for the control on the page.