noulouk
asked on
Retrieve dynamically created TextBox value
Hi Experts,
I have created a table dynamically with 1 textbox and 1 button:
private dynamicTable()
{
Table Mytable=new Table();
TableRow row1=new TableRow();
TableCell cell1=new TableCell();
TextBox mytextbox=new TextBox();
mytextbox.ID="mybox";
LinkButton mybutton=new LinkButton();
mybutton.ID="mybutton";
mybutton.Click+=new EventHandler(mybutton_Clic k);
cell1.Controls.Add(mytextb ox);
cell1.Controls.Add(mybutto n);
row1.Cells.Add(cell1);
Mytable.Rows.Add(row1);
PlaceHolder1.Controls.Add( MyTable);
}
private void mybutton_Click(object sender, EventArgs e)
{
Table Mytable=(Table)((LinkButto n)sender). Parent;
Response.Write(((TextBox)M ytable.Fin dControl(" mybox")).T ext);
}
The problem is when I click the button, I can't retrieve my textbox value.
Where did I make a mistake ?
Thanks for your answers.
I have created a table dynamically with 1 textbox and 1 button:
private dynamicTable()
{
Table Mytable=new Table();
TableRow row1=new TableRow();
TableCell cell1=new TableCell();
TextBox mytextbox=new TextBox();
mytextbox.ID="mybox";
LinkButton mybutton=new LinkButton();
mybutton.ID="mybutton";
mybutton.Click+=new EventHandler(mybutton_Clic
cell1.Controls.Add(mytextb
cell1.Controls.Add(mybutto
row1.Cells.Add(cell1);
Mytable.Rows.Add(row1);
PlaceHolder1.Controls.Add(
}
private void mybutton_Click(object sender, EventArgs e)
{
Table Mytable=(Table)((LinkButto
Response.Write(((TextBox)M
}
The problem is when I click the button, I can't retrieve my textbox value.
Where did I make a mistake ?
Thanks for your answers.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.