If this quest is not belong to this forum, I am sorry.
But I think this question seem to be this forum.
My problem is while I select a dropdownlist's item and click a button but the result do not show my select dropdownlist item.
My code as follows using C#.
Expand|Select|Wrap|Line Numbers
- protected void Page_Load(object sender, EventArgs e)
- {
- DropDownList1.AutoPostBack = true;
- DropDownList1.Items.Clear();
- DropDownList1.Items.Add(new ListItem("test1","0"));
- DropDownList1.Items.Add(new ListItem("test2", "1"));
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- TextBox1.Text = DropDownList1.SelectedItem.Text;
- }
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
- {
- //DropDownList1.Items.FindByValue();
- DropDownList1.ClearSelection();
- DropDownList1.Items.FindByValue(DropDownList1.SelectedValue).Selected = true;
- TextBox1.Text = DropDownList1.SelectedValue;
- }
Thanks very much.
Jim