Disable Postback event of Button

  • Thread starter Arvind P Rangan
  • Start date
A

Arvind P Rangan

Hi,

Has anybody worked on disabling postback event of button event in webforms.

As it does not have a property of autopostback how do we make it disable.

I tried few article but they have given example of disabling the button not
disabling postback event!!!

Thanks
Arvind
 
O

Onin Tayson

remove the runat="server" attribute or

you can also add an onclick attribute to the button and return true i.e.
YourButton.Attributes.Add("onclick", "<script>return true</script>");

HTH,
 
M

Mr Newbie

ASP.NET Buttons will allways render as <INPUT Type="Submit" RunAt=Server>,
If you think about it, what would be the point of adding a server control
button which did not postback.

If you want button functionality which does not postback, then add an HTML
button which has the type button.

HTH Mr Newbie
 
S

S. Justin Gengo

Arvind,

Are you attempting to keep a form from being submitted more than once?

If that's the case I have a Javascript component available for free on my
website, www.aboutfortunate.com, which contains a method for disabling a
submit button after the first click. The component also contains some other
useful javascripts, but even if you don't want those you could still just
strip out the code for disabling the postback on the second click.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
A

Arvind P Rangan

thanks everyone,

We had worked on HTML control but has anyone as worked on asp:button on the
same.

ARvind
 
Joined
Jul 28, 2009
Messages
1
Reaction score
0
Simple

<asp:ImageButton ID="btnImage" runat="server" OnClientClick="return false;"/></a>

This will disable postback event.

Sejal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top