Client-side IsPostback checking
I ran into a situation that I have to write JavaScript that execute only when the page is posted back. Currently there’s no straight forward way in ASP.NET Ajax to check IsPostback from JavaScript. If you google around, you might find various way of getting this to work, like this one.
After some thought, the easiest hack I came up with is this.
function IsPostBack() {
return <%= IsPostBack.ToString().ToLower() %>;
}
![]()
Teera on July 18th 2008 in ASP.NET, Software Development, Web Dev, .NET