Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
XML
var btn = document.getElementById("<%=Button1.ClientID %>");
               btn.click();
               __doPostBack('btn', 'OnClick');




                <div style="display: none;">
                <asp:Button ID="Button1"  runat="server"  OnClick="btnSubmit_Click"/>
                 </div>



           C# Codebind

          public void <btnSubmit_Click(object sender, EventArgs e)
          {
        //Code

           }
Posted
Updated 25-Jul-15 1:07am
v2
Comments
Sreekanth Mothukuru 25-Jul-15 8:54am    
What compelled you to use __doPostBack ?

1 solution

Even though we use same version of IE (IE8), on different Microsoft OS, IE responds in different manner for same set of codes certain times.
Recently I also faced such kind of error where in Same part of JavaScript code and Button Click event behaved differently in window XP and Windows 7 and Windows Server 2012.
On window XP button event worked properly but on Windows 7 click event didn't fired and on windows 2012 _doPostBack error is raised by IE javascript.
I haven't found a root cause for it, but there are certain things you can check in you code and javascript.

* Makes sure there are no junk characters in javascript code (Some times junk characters are not visible).
* Check if you are using Update Panel on your page. Your Button may be outside update panel. Add PostBack or AsycnPostBack trigger on the button control to this Update Panel. Ajax Update Panel also shows different behavior on different OS.
 
Share this answer
 
Comments
Sathish km 28-Jul-15 0:58am    
Thank u man.Working fine. u r great!
Roshan 11862764 30-Jul-15 15:07pm    
so what was your issue, junk character or Ajax?
Sathish km 30-Jul-15 23:52pm    
I just put my button outside of my Update panel.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900