Dynamically created asp textbox - need to assign a different ID

S

Shilpi Chaudhry

I have a forloop which I use to create textboxes - but unfortunately
all of them have the same ids - I need to assign different ids to
these textboxes creeated in the loop so that I can retrieve their
corrs values. Anybody??

Code snippet:

<%
int y = 7;
%>

<table style="Z-INDEX: 101; LEFT: 316px; WIDTH: 355px; POSITION:
absolute; TOP: 167px; HEIGHT: 150px">
<%
for(int i=0; i<3; i++)
{
%>
<tr>
<td style="WIDTH: 182px; HEIGHT: 32px">
<asp:label id="Label1" runat="server" Width="127px"
Font-Bold="True">Parameter #</asp:label>
</td>
<td style="HEIGHT: 32px">
<asp:textbox id="ID_PARAMETER_NUMBER" runat="server"
ReadOnly="True" Width="152px "></asp:textbox>
</td>
</tr>
<tr>
<td style="WIDTH: 182px">
<asp:Label id="Label2" runat="server">Parameter Name</asp:Label>
</td>
<td>
<asp:TextBox id="ID_EDIT_PARAMETER_NAME" runat="server"
Width="156" Height="24"></asp:TextBox>
</td>
</tr>
<tr>
<td style="WIDTH: 182px">
<asp:Label id="Label3" runat="server">Value Type</asp:Label>
</td>
<td>
<asp:TextBox id="ID_EDIT_VALUE_TYPE"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="WIDTH: 182px">
<asp:Label id="Label4" runat="server">Value</asp:Label>
</td>
<td>
<asp:TextBox id="ID_EDIT_VALUE" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="WIDTH: 182px">
<asp:Label id="Label5" runat="server">Value Source</asp:Label>
</td>
<td>
<asp:TextBox id="ID_EDIT_VALUE_SOURCE"
runat="server"></asp:TextBox>
</td>
</tr>
<tr></tr>
<tr></tr>
<%
}
%>

</table>

Thanks, Shilpi
 
H

Hermit Dave

Shilpi,

I do not use embedding but with code behind you should be alright. If you
need any help with codebehind related snippet which would help then please
do let me know.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top