开发者

Exending Textbox to have a Unique Name

开发者 https://www.devze.com 2023-01-12 13:06 出处:网络
Is it possible 开发者_StackOverflow社区to Exend Textbox to have a Unique Name ? I have tried using UniqueID poperty,but this is not accessible with Request.Form(\"UniqueID\")By default, all ASP.NET co

Is it possible 开发者_StackOverflow社区to Exend Textbox to have a Unique Name ? I have tried using UniqueID poperty,but this is not accessible with Request.Form("UniqueID")


By default, all ASP.NET controls receive a unique ID and name (except for checkboxes and radio buttons which may have the same name, but different IDs).

If you gave your TextBox an ID, like so:

<asp:TextBox ID="txtFirstName" runat="server" />

Then you should be able to access it in code behind as a member of that name (txtFirstName).

If you want access through Request.Form, you can access it like so:

string textBoxValue = Request.Form[txtFirstName.ClientID]


In ASP.NET any control you have will have a uniquie ID based on its assigned ID value. You can only assign IDs via the .ID property. The .UniqueID and .ClientID properties are read-only properties that give you those corresponding values, but can not be modified directly.

0

精彩评论

暂无评论...
验证码 换一张
取 消