T
tarscher
Hi all,
When a user clicks a button controls are generated
protected void keywordsDropDownList_SelectedIndexChanged(object
sender, EventArgs e)
{
int numberOfTextBoxes =
Convert.ToInt16(keywordsDropDownList.Text);
TextBox myTextBox;
for (int i = 0; i < numberOfTextBoxes; i++)
{
myTextBox = new TextBox();
myTextBox.ID = "parameterTextBox" + Convert.ToString(i);
myTextBox.Columns = 5;
buttonPlaceHolder.Controls.Add(myTextBox);
}
addKeywordButton.Visible = true;
MultiView1.SetActiveView(KeywordView);
TextBox myTB;
myTB =
(TextBox)buttonPlaceHolder.FindControl("parameterTextBox1");
}
The FindControl finds the parameterTextBox1 and copies it to myTB
correctly.
When a user now clicks a button after he clicked the previous one I do:
protected void addKeywordButton_Click(object sender, EventArgs e)
{
TextBox myTB;
myTB =
(TextBox)buttonPlaceHolder.FindControl("parameterTextBox1");
}
Here FindControl can't find the control and myTB is null.
I really can't find the problem so any help is greatly appreciated.
best regards
Stijn
When a user clicks a button controls are generated
protected void keywordsDropDownList_SelectedIndexChanged(object
sender, EventArgs e)
{
int numberOfTextBoxes =
Convert.ToInt16(keywordsDropDownList.Text);
TextBox myTextBox;
for (int i = 0; i < numberOfTextBoxes; i++)
{
myTextBox = new TextBox();
myTextBox.ID = "parameterTextBox" + Convert.ToString(i);
myTextBox.Columns = 5;
buttonPlaceHolder.Controls.Add(myTextBox);
}
addKeywordButton.Visible = true;
MultiView1.SetActiveView(KeywordView);
TextBox myTB;
myTB =
(TextBox)buttonPlaceHolder.FindControl("parameterTextBox1");
}
The FindControl finds the parameterTextBox1 and copies it to myTB
correctly.
When a user now clicks a button after he clicked the previous one I do:
protected void addKeywordButton_Click(object sender, EventArgs e)
{
TextBox myTB;
myTB =
(TextBox)buttonPlaceHolder.FindControl("parameterTextBox1");
}
Here FindControl can't find the control and myTB is null.
I really can't find the problem so any help is greatly appreciated.
best regards
Stijn