Add event name
ddlEmployee_SelectedIndexChanged
in dropdown list and set dropdownlist
AutoPostBack="True"
to call the event in aspx.cs file.
Example :
<asp:DropDownList ID="ddlEmployee" runat="server" AutoPostBack = "true" OnSelectedIndexChanged = "ddlEmployee_SelectedIndexChanged">
<asp:ListItem Text="Ram" Value="1" />
<asp:ListItem Text="Shyam" Value="2" />
<asp:ListItem Text="Mohan" Value="3" />
<asp:ListItem Text="Gaurav" Value="4" />
<asp:ListItem Text="Shohan" Value="5" />
</asp:DropDownList>
protected void ddlEmployee_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = ddlEmployee.SelectedItem.Value;
}
Now you will get the selected value of dropdownlist into your textbox.