Hi nagaraju60,
Check this example. Now please take its reference and correct your code.
I have the Database Table and sample record like below.
![](https://i.imgur.com/CzGFBEz.jpg)
HTML
<asp:DropDownList runat="server" ID="DropDownList1" AutoPostBack="true" OnSelectedIndexChanged="DropdownChanged"
AppendDataBoundItems="true">
<asp:ListItem Text="-Select-" Value="0" />
</asp:DropDownList>
<br />
<asp:Label ID="lblName" runat="server" />
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2] { new DataColumn("No"), new DataColumn("Name") });
dt.Rows.Add(25, "John Hammond");
dt.Rows.Add(1, "Mudassar Khan");
dt.Rows.Add(28, "Suzanne Mathews");
dt.Rows.Add(2, "Maria");
dt.Rows.Add(3, "Ana Trujillo");
dt.Rows.Add(4, "Antonio Moreno");
dt.Rows.Add(5, "Thomas Hardy");
dt.Rows.Add(6, "Christina Berglund");
dt.Rows.Add(7, "Hanna Moos");
dt.Rows.Add(32, "Robert Schidner");
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "No";
DropDownList1.DataBind();
}
}
protected void DropdownChanged(object sender, EventArgs e)
{
int selectedValue = Convert.ToInt32(DropDownList1.SelectedValue);
lblName.Text = GetExistingName(selectedValue);
}
private string GetExistingName(int value)
{
CustomersDataContext dc = new CustomersDataContext();
string existingName = (from customer in dc.Customers
where customer.CustomerId == value
select customer.Name).FirstOrDefault();
return string.IsNullOrEmpty(existingName) ? "" : existingName;
}
Screenshot
![](https://i.imgur.com/jeM7Fg7.gif)