I want to bind dropdown list in a gridview with datasiursce coming from data base, and i also want to edit and update it if required.
The datasource contains the data i want to fetch,its doesnt bind
if (gvItem.Rows.Count > 0) { for (int i = 0; i < gvItem.Rows.Count; i++) { DropDownList sup = (DropDownList)gvItem.Rows[i].FindControl("ddlsup"); baplan.Condition = "sup"; DataSet dss = new DataSet(); dss = baplan.getpro(); sup.DataSource = dss; sup.DataBind(); sup.DataTextField = "Name"; sup.DataValueField = "Id"; } }
Advertisement
Answer
if (gvItem.Rows.Count > 0) { for (int i = 0; i < gvItem.Rows.Count; i++) { DropDownList sup = (DropDownList)gvItem.Rows[i].FindControl("ddlsup"); baplan.Condition = "sup"; DataSet dss = new DataSet(); dss = baplan.getpro(); sup.DataSource = dss; sup.DataTextField = "Name"; sup.DataValueField = "Id"; sup.DataBind(); } }