Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controlling textbox ids
Message
 
To
03/12/2002 08:31:18
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00728819
Message ID:
00729281
Views:
9
Rex,

You can bind each textbox like you do normally, either in code-behind or through databinding in the html.

>Cathi,
>
>Would I then have to populate each textbox separately, like the checkboxlist, or can I have databinding do this as well?
>
>TIA
>
>Rex
>
>>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=< % ERROR: # items  % >
>>runat="server">
>>      <itemtemplate>
>>          <tr>
>>              <th>
>>                   time< % ERROR: # Container.DataItem  % >
>>              </th>
>>              <td>
>>                   <asp:textbox id="TextBox1"
>>                        cssclass="TextInput" runat="server" />
>>              </td>
>>              <th>
>>                   time< % ERROR: # 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
Reply
Map
View

Click here to load this message in the networking platform