Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Martin #1
control id and name for postback mechanism
Hi,
This may be a dumb question, but why is it necessary for a control's id and
name attribute to coincide in order for the postback mechanism to work?
Given that it appears to be necessary, why are they not wired to be the same
value in a base class like control or webcontrol?
Thanks
Martin
Martin Guest
-
why does my control retain its value after postback
i am not implementing any state mechanisms or IPostBackEventHandler in my control, but when my asp.net page accesses the control, the data that was... -
help with postback-less calendar control.
hi, I need to create a Calendar control that does not do postback when a date is selected...any ideas on how to do this thanks in advance... -
Did my control caused the postback
You want to know it on Page or in the control itself? If your control implements IPostBackEventHandler, you could override RaisePostBackEvent on... -
control not found on postback
Hi, i am trying to analyze data submitted in a form but the problem is that when i try to create the controls in code (which is what i want to... -
Which control had focus before postback?
Hi, Is it possible to retrieve the control that had the focus when the page was posted back? Because the focus is lost when a postback occurs... -
Teemu Keiski #2
Re: control id and name for postback mechanism
Remember that the value in name attribute matches control's UniqueID, that
is unique ID value so that control can be distinguished from the other
controls, e.g to know which control is in question. UniqueID contains path
of IDs with predefined separators revealing the control path in which the
current control is located in.
Page.FindControl method on the other hand is able to locate the control (and
return reference to it) when it is given a unique id. In other words it
doesn't need to loop through all the controls, evaluating which one's ID
would match. And this is used with postback processing, and is one reason
why name must match UniqueID. It not just finds the control, superfast, but
also causes child control hierarchies to be created (ensures that control
receiving postback is there).
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
[url]http://blogs.aspadvice.com/joteke[/url]
"Martin" <x@y.z> wrote in message
news:%23ZFMd%23pwGHA.5068@TK2MSFTNGP02.phx.gbl...> Hi,
>
> This may be a dumb question, but why is it necessary for a control's id
> and name attribute to coincide in order for the postback mechanism to
> work?
>
> Given that it appears to be necessary, why are they not wired to be the
> same value in a base class like control or webcontrol?
>
> Thanks
> Martin
>
>
Teemu Keiski Guest



Reply With Quote

