__doPostBack not working for me

hhh3112 picture hhh3112 · Apr 24, 2011 · Viewed 28.4k times · Source

Is there an error in the way i use the __doPostBack?

function displaymessage() {
  var scl = "aaaaaa";
  var pageId = '<%=  Page.ClientID %>';
  __doPostBack(pageId, 'OtherInformation');
  alert(scl);
}

<input type="button" value="Click me!" id="Button2" onclick="displaymessage()"   />

When i press the button it should call the RaisePostBackEvent in the code file, but it doesn't. If i comment the doPostBack it reaches the alert but when it is uncommented it does not. So it must be an error in the usage of the doPostBack.

I followed this post: Call ASP.NET function from JavaScript?

Answer

Marimuthu picture Marimuthu · Nov 27, 2015

for me the _dopostback() was not firing only on IE and chrome browser. I have resolved by adding "return false;" statement in the javascript function. for example:-

  function test()
{
    _dopostback("logout","");
return false;
}

now its working fine.