public void load() { DropDownList1.DataTextField = "status"; DropDownList1.DataValueField = "Table_ID"; Table_SatausBLL obj = new Table_SatausBLL(); DropDownList1.DataSource = obj.GetList(); DropDownList1.DataBind(); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowState == DataControlRowState.Alternate || e.Row.RowState == DataControlRowState.Normal) { ((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确认要删除“" + e.Row.Cells[1].Text + "”吗');"); } if (e.Row.RowState == DataControlRowState.Edit || e.Row.RowState == (DataControlRowState.Alternate | DataControlRowState.Edit)) { DropDownList d = ((DropDownList)(e.Row.Cells[2].FindControl("DropDownList1"))); d.DataTextField = "status"; d.DataValueField = "Table_ID"; Table_SatausBLL obj = new Table_SatausBLL(); d.DataSource = obj.GetList(); d.DataBind(); } } }