How ASP. NET controls interact with the server

Source: Internet
Author: User

when I used to write ASP's Program , I knew that only the buttons whose type is set to submit are available, to trigger the form to submit data to the server.
for example, Asp. the button in. NET is equal to .
but now ASP. net controls can interact with the server at will, such as linkbutton.
how is this implemented?
is it a brand new method?
in fact, this is only a work und for Microsoft.
let's take a look at the client's Code .
here is a page with a linkbutton.
In fact, The linkbutton is equivalent to a in HTML on the client.
Let's see why linkbutton can interact with the server?
when we right-click to view the Source Code on the page, we can see:

click me


from the code above, we can see that simplelinkbutton1 is A link, submit the form using the client code.
the two hidden fields are used to exchange data. The two parameter values of _ dopostback are assigned to the two hidden fields.
This is why linkbutton has the most intuitive way to submit data.

How is the above Code generated?
we can see the source code of linkbutton clearly:
protected internal override void onprerender (eventargs e)
{< br> base. onprerender (E);
If (this. page! = NULL) & this. enabled)
{< br> This. page. registerpostbackscript ();
If (this. causesvalidation & (this. page. getvalidators (this. validationgroup ). count> 0) |! String. isnullorempty (this. postbackurl)
{< br> This. Page. registerwebformsscript ();
}< BR >}

the above is just a record of some of your experiences in the course of study and work, to prevent you from forgetting.
I also hope to have more discussions with you!

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.