Hi!
Okay, here's the issue:
I have a nested repeater with this:
<td width="125px"><input type="text" name="M<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="10" maxlength="10"></td>
<td width="350px"><input type="text" name="C<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="50" maxlength="100"></td>
I need to search the page, find all the text boxes and get their values. However, I don't know anything about the ID other than it starts with a C or an M. I can't get a count from my initial data, so I query again to get the number of text boxes possible.
Even with a loop I cannot seem to actually "find" the objects. Any thoughts on any way to do this at all? foreach?
HI KAREN,
to get all the controls within a form, u can use
Controls oFormControls=this.Controls;
it returns all the controls on the form. but it better if u put all the textbox in groupbox or panel. then it'll iterate throw few controls.
//this code iterate throw all controls on the form
foreach (Control ctl in this.Controls)
{
if(ctl.GetType().Name== "TextBox")
{
if(ctl.Name="txtName")
string sName=ctl.Text;
}
}
//this code iterate throw all controls on the grpTextBox of the form
foreach (Control ctl in this.grpTextBox.Controls)
{
if(ctl.GetType().Name== "TextBox")
{
if(ctl.Name="txtName")
string sName=ctl.Text;
//do something
}
}
i think it resolve ur problem. if not or u want to know more about it, mail me to
[email removed]
!!! SHIPON !!!