// Select * from Countries
// Select CustID,CountryID from Customers where CustID=1
DataSet ds = new DataSet();
da.Fill(ds, "Countries");
ddl.DataSource = ds.Tables[0];
ddl.DataTextField = "CountryName";
ddl.DataValueField = "CountryID";
ddl.SelectedValue = ds.Tables[1].Rows[0]["CountryID"].ToString();
ddl.DataBind();
O/p:
Tags: asp.net, binding, selected value, data base
// Select CustID,CountryID from Customers where CustID=1
DataSet ds = new DataSet();
da.Fill(ds, "Countries");
ddl.DataSource = ds.Tables[0];
ddl.DataTextField = "CountryName";
ddl.DataValueField = "CountryID";
ddl.SelectedValue = ds.Tables[1].Rows[0]["CountryID"].ToString();
ddl.DataBind();
O/p:
Tags: asp.net, binding, selected value, data base
No comments:
Post a Comment