public void Dropdownlist2()//gridvalues1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
SqlConnection con = new SqlConnection(ConnectionString);
//con.Open();
string str = "select month,week from duration";
SqlCommand cmd = new SqlCommand(str, con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter();
// DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.SelectCommand = cmd;
da.Fill(dt);
DropDownList2.DataSource = dt;
DropDownList1.DataTextField = "month";
// DropDownList1.DataValueField = "Title";
DropDownList2.DataValueField = "month";
DropDownList2.DataBind();
}
catch (Exception ex)
{
throw (ex);
}
}
No comments:
Post a Comment