For example:
href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$PlaceHol开发者_开发技巧derMain$g_188da349_7fe9_42f0_9a95_40cee6cd37a4$ctl00$ctl05$lbtnApplicationName','')">
What are this contents behind call?
This is part of the HTML sent to the browser for "server side" link button:
<asp:LinkButton id="lbtnApplicationName" runat="server" OnClick="SomeFuncHere" Text="Get Application Name" />
And this button is inside unnamed control that is named ctl05
by default, and is inside other control that also has no name thus got the default name ctl00
etc.. etc.. etc..
In general, the ASP.NET
framework is building the final ID of element based on its direct ID and chaining the ID of its parent controls - content placeholders included.
For form elements, their name
is built in similar way with the exception that instead of _
, it's using $
to "chain" the ID of the parents.
Why? To avoid the possibility of having more than one element with same ID in the same HTML document. (Or two form elements with same name when they're in different controls)
Now this final ID is used to tell the server what control invoked the PostBack - this is done using JavaScript function written to the page automatically by the framework that get the ID of the element as its argument.
精彩评论