I have an auto-generated radgrid bound to a table. In Edit Mode, in the code-behind, I have successfully created a drop-down list to replace the default a textbox for ONE column.
This drop down list pulls its list items from a second table and data source. The FAILURE POINT is that the selected item from the drop down list is not SAVED to the subject tablet record. The other columns will update and save properly.
The code behind that WORKS for creating the substitute drop-down is here, with my notation as to where I am GUESSING I need to do something correctly. I have tried every possible forum suggestion, but the source of my pain is that the value in the drop-down list is not being passed to the actual column value on update. Been stuck for several hours on this one. Probably something silly that I will kick myself for, but not the first time.
<
p
></
p
>protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem edit = (GridEditableItem)e.Item;
edit["EmployeeRecordID"].Visible = false;
SqlConnection con = new SqlConnection(MasterConnectionString);
String queryString = "SELECT GroupLabel From Groups";
con.Open();
SqlDataAdapter dr = new SqlDataAdapter(queryString, con);
DataTable dt = new DataTable();
dr.Fill(dt);
con.Close();
ddledit = (GridEditableItem)e.Item;
txt = (TextBox)ddledit["GroupAssociation"].Controls[0];
//txt.Visible = false;
DropDownList droplist = new DropDownList();
droplist.DataSource = dt;
droplist.DataTextField = "GroupLabel";
droplist.DataValueField = "GroupLabel";
droplist.DataBind();
ddledit["GroupAssociation"].Controls.Add(droplist);
}
}
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
//this is where I THINK my failure point is, but not sure.
}