Introduction:
In some cases we need to use button as only onclient click
event,in that case we don’t like the
postback of button control.
To avoid the button postback the following code has helpful
to solve the problem…..
Code:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick ="scrfn();return false;" />
|
In button control just add only the return false in on
client click event…Also if need to call any script function you can as its in
on client click event….
Second method adds the below code in load event to avoid
button post back…..
Button1.Attributes.Add("onclick",
"return false;")
|
I hope you like this technique to avoid the button postback…
0 comments:
Post a Comment