[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Object Delayed loading dynamically into Placeholder

MattKlepeis

10/5/2006 2:29:00 PM

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.
}

}

1 Answer

cld

2/25/2007 1:51:00 AM

0

MattKlepeis@gmail.com wrote:
> 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.
> }
>
> }
>
I do this by dynamically building the control at the client. You may
explore using AJAX methodology for this requirement.
Good luck