Setting Uniqueid for hidden fild in asp.net
i am trying to set UniqueID for a hidden field control .its throwing me error
The 'UniqueID' p开发者_如何学JAVAroperty is read-only and cannot be set.
How to solve this issue ??
my code
<asp:HiddenField ID="hSequence" runat="server" UniqueID="hSequence" />
If you define the HiddenField like this:
You can access identifiers from the Server Side like this:
hSequence.Value
or
Request.Params[hSequence.ClientID]
Q: You can not to consider to use the ID property as research key for your asp.net controls?
This identifier is generated automatically when a page request is processed.you can just Get it not Set
public virtual string UniqueID { get; }
also see Control.UniqueID Property
The UniqueID is auto-generated based on the control hierarchy. You cannot set it. Why do you want to do that anyway? Perhaps we can help you with another solution.
精彩评论