I have a button and I want to stop post back whenever someone clicks on that button.
I don't want to use return false like this
<asp:Button runat="server" Text="Click" OnClick="Unnamed1_Click" OnClientClick="javascript:return false;" />
I want to stop it from code behind.
I want to create a div and some content inside the div , so when ever someone click on that button another div will be created with it's contents, but the problem is when I click the button and a post back happen , it remove the first div and construct the second one and so on
Something you can do is to disable your button after a user click on them it also disable the postback behaviour and prevent future postback, in this way
protected void Unnamed1_Click(object sender, EventArgs e) {
YourButton.Enabled = false;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.