Not showing values in dropdownlist
and error in button
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string query = "SELECT [Model], [SN] FROM ['ISB VAS Nodes$']";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(query, connstring);
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "Model";
DropDownList1.DataValueField = "sn";
DropDownList1.DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string searchTXt = GridView2.SelectedValue.ToString(); //in this line
string query = "SELECT [Model], [SN] FROM ['ISB VAS Nodes$']";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(query, connstring);
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
GridView2.DataSource = ds;
GridView2.DataBind();
}
}