Wednesday, 26 August 2009

Stop Postback in .NET

For example, if i had an ImageButton object and I would like some Javascript to execute upon clicking this control, I would add the JS on code behind like so...


btnViewParts.Attributes.Add("OnClick","ViewParts(); return false;");

The return false; Portion of this code prevents the postback.

No comments: