I have a Dropdownlist & based on its selection I need to populate data in a textbox that has a label in it. So basically populate the label. This is my code:
Aspx Page: <asp:DropDownList ID="DDLTest" runat="server" AutoPostBack="true" onselectedIndexChanged="DDLTest_SelectedIndexChanged" Width="200px">
<asp:Label id="Label1" AssociatedControlId="textbox"
runat="server" /> <asp:TextBox id="textbox1" runat="server" />
code behind:
protected void DDLEmployeeNames2_SelectedIndexChanged(object sender, EventArgs e)
{
if (DDLTest.SelectedItem != null)
Textbox1.Text = DDLTest.SelectedItem.Text;
}
When I execute the code, I get the default value in the drop down displaying in the Textbox which is "Select a Value" whereas the actual selected value doesn't display. Any ideas as to what is happening?

New Topic/Question
Reply




MultiQuote




|