Dynamically created asp textbox - need to assign a different ID

Discussion in 'ASP .Net' started by Shilpi Chaudhry, Sep 14, 2004.

  1. 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
     
    Shilpi Chaudhry, Sep 14, 2004
    #1
    1. Advertising

  2. Shilpi Chaudhry

    Hermit Dave Guest

    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)
    "Shilpi Chaudhry" <> wrote in message
    news:...
    > 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
     
    Hermit Dave, Sep 15, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack Johnston
    Replies:
    5
    Views:
    595
    Natty Gur
    Jul 28, 2003
  2. Raed Sawalha
    Replies:
    2
    Views:
    1,554
    =?Utf-8?B?UHN5Y2hv?=
    Oct 5, 2004
  3. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    7
    Views:
    913
    Swanand Mokashi
    Apr 5, 2006
  4. msimmons
    Replies:
    0
    Views:
    544
    msimmons
    Jul 16, 2009
  5. vega80
    Replies:
    1
    Views:
    203
Loading...

Share This Page