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!