M
MattKlepeis
I have a placeholder and I have a section of code that will load a
question into the placeholder depending on what is selected in a group
of dropdownlists.
The problem that I am running into is that the questions that are
loading are for the previously selected request. The questions are not
popping up real time.
Here is my section of code, any help you could give would be greatly
appreciated
protected void ddlRequest_SelectedIndexChanged(object sender, EventArgs
e)
{
//phTextBoxes.Controls.Clear();
int index = ddlRequest.SelectedIndex;
test.Text = index.ToString();
questionSource.SelectCommand = "SELECT assoc_request, question,
question_id, question_num FROM nocsr_question WHERE assoc_request = " +
index;
for (int counter = 1;counter <= ddlQuestion.Items.Count;
counter++)
{
TextBox tb = new TextBox();
tb.Width = 200;
tb.Height = 20;
//tb.TextMode = TextBoxMode.MultiLine;
tb.ID = "TextBoxID" + (counter + 1).ToString();
// add some dummy data to textboxes
tb.Text = "This is textbox " + counter;
phTextBoxes.Controls.Add(new LiteralControl("<b>" +
ddlQuestion.Items.FindByValue(counter.ToString()) + ": </b>"));
phTextBoxes.Controls.Add(tb);
phTextBoxes.Controls.Add(new LiteralControl("<br>"));
Page.
}
}
question into the placeholder depending on what is selected in a group
of dropdownlists.
The problem that I am running into is that the questions that are
loading are for the previously selected request. The questions are not
popping up real time.
Here is my section of code, any help you could give would be greatly
appreciated
protected void ddlRequest_SelectedIndexChanged(object sender, EventArgs
e)
{
//phTextBoxes.Controls.Clear();
int index = ddlRequest.SelectedIndex;
test.Text = index.ToString();
questionSource.SelectCommand = "SELECT assoc_request, question,
question_id, question_num FROM nocsr_question WHERE assoc_request = " +
index;
for (int counter = 1;counter <= ddlQuestion.Items.Count;
counter++)
{
TextBox tb = new TextBox();
tb.Width = 200;
tb.Height = 20;
//tb.TextMode = TextBoxMode.MultiLine;
tb.ID = "TextBoxID" + (counter + 1).ToString();
// add some dummy data to textboxes
tb.Text = "This is textbox " + counter;
phTextBoxes.Controls.Add(new LiteralControl("<b>" +
ddlQuestion.Items.FindByValue(counter.ToString()) + ": </b>"));
phTextBoxes.Controls.Add(tb);
phTextBoxes.Controls.Add(new LiteralControl("<br>"));
Page.
}
}