Asp.net click the button to submit and the button becomes unavailable

Source: Internet
Author: User

. Aspx
Copy codeThe Code is as follows:
<Script language = "javascript">
Function abc ()
{
Var mybutton = document. getElementById ("Submit1 ");
Mybutton. disabled = true; // gray
_ DoPostBack ("Submit1", ""); // executes the click event of Submit1 on the server.
}
</Script>
<Form id = "Form1" method = "post" runat = "server">
...
<INPUT id = "Submit1" type = "submit" value = "Start upload" name = "Submit1" runat = "server">
....
</Form>

. Cs
Copy codeThe Code is as follows:
Private void Page_Load (object sender, System. EventArgs e)
{
...
This. GetPostBackEventReference (Submit1); // this sentence is critical. this sentence allows the client to execute server events.
Submit1.Attributes. Add ("onclick", "abc ();");
....
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.