ow to find Textbox ID's binded inside Grid view
-
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding)
void tb1_DataBinding(object sender, EventArgs e)
{TextBox txtdata = (TextBox)sender; txtdata.TextMode = TextBoxMode.MultiLine; txtdata.Width = Unit.Pixel(300); txtdata.Height = Unit.Pixel(70); ** txtdata.ID = "txtItemBox";**
}
void ITemplate.InstantiateIn(System.Web.UI.Control container)
{
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding);
container.Controls.Add(tb);}
Calling tb1_DataBinding to build a grid view column with text boxes i am getting text box with databse values but i am not able to find ID's of each text boxes say for example a row has three text boxes and i need to take each text box ID's and giving to control to . how to get ID's of each text boxes inside grid view.
-
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding)
void tb1_DataBinding(object sender, EventArgs e)
{TextBox txtdata = (TextBox)sender; txtdata.TextMode = TextBoxMode.MultiLine; txtdata.Width = Unit.Pixel(300); txtdata.Height = Unit.Pixel(70); ** txtdata.ID = "txtItemBox";**
}
void ITemplate.InstantiateIn(System.Web.UI.Control container)
{
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding);
container.Controls.Add(tb);}
Calling tb1_DataBinding to build a grid view column with text boxes i am getting text box with databse values but i am not able to find ID's of each text boxes say for example a row has three text boxes and i need to take each text box ID's and giving to control to . how to get ID's of each text boxes inside grid view.
-
Did you tried with the Find method of GridViewControl, which gets you the control and thereby all the attributes.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
-
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding)
void tb1_DataBinding(object sender, EventArgs e)
{TextBox txtdata = (TextBox)sender; txtdata.TextMode = TextBoxMode.MultiLine; txtdata.Width = Unit.Pixel(300); txtdata.Height = Unit.Pixel(70); ** txtdata.ID = "txtItemBox";**
}
void ITemplate.InstantiateIn(System.Web.UI.Control container)
{
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(tb1_DataBinding);
container.Controls.Add(tb);}
Calling tb1_DataBinding to build a grid view column with text boxes i am getting text box with databse values but i am not able to find ID's of each text boxes say for example a row has three text boxes and i need to take each text box ID's and giving to control to . how to get ID's of each text boxes inside grid view.
I dont see any relation between the tb object in the ITemplate.InstantiateIn method and the tb object in the upper section of your code. Would not it be better if you added the event handling code to the same block of code that creates the text box? So, just after creating the tb object (in upper section of your post), add the event handler to the tb object. Shreekar