Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controlling textbox ids
Message
 
To
02/12/2002 18:16:51
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00728819
Message ID:
00728884
Views:
10
You can assign the id in the html view of your aspx page. Here is some sample code where the id is assigned:
<asp:repeater id="DataInputTableElements" datasource=<%# items %>
runat="server">
      <itemtemplate>
          <tr>
              <th>
                   time<%# Container.DataItem %>
              </th>
              <td>
                   <asp:textbox id="TextBox1"
                        cssclass="TextInput" runat="server" />
              </td>
              <th>
                   time<%# Container.DataItem %>
              </th>
              <td>
                   <asp:textbox id="TextBox2"
                        cssclass="TextInput" runat="server" />
              </td>
            </tr>
    </itemtemplate>
</asp:repeater>
Then to iterate through the Textboxes inside the repeater you would use the foreach loop like below:
foreach (RepeaterItem ri in myRepeater.Items)
   {
    // get the txtbox
    TextBox txt = ((TextBox)ri.FindControl("myTextbox"));
   }
>All,
>
>I am creating Web textboxes via a repeater. I know the page creates a unique id for each textbox, but I want to be able to define the ids.
>
>I need to be able to pick the textboxes from the page so I can save the values back to the tables.
>
>How can I do this?
>
>TIA
>
>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform