Hello!
I am trying to configure my updatecommand for a RadGrid dropdownlist edit entry. I have attached the code for the dropdownlist and my current update command below
DropDownList
if (e.Item is GridEditableItem && e.Item.IsInEditMode && !(e.Item is GridEditFormInsertItem))
{
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [ExampleDB].[dbo].[Status]", connection);
DataSet ds = new DataSet();
da.Fill(ds);
GridEditableItem edit = (GridEditableItem)e.Item;
TextBox txt = (TextBox)edit["Status"].Controls[0];
txt.Visible = false;
DropDownList droplist = new DropDownList();
droplist.DataSource = ds;
droplist.DataTextField = "Name";
droplist.DataValueField = "ID";
droplist.DataBind();
edit["OrderStatus"].Controls.Add(droplist);
}
Update Command
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e){
GridEditableItem editableItem = ((GridEditableItem)e.Item);
Hashtable values = new Hashtable();
editableItem.ExtractValues(values);
string query = "UPDATE [MSIMM].[dbo].[Order] SET OrderStatusID=@OrderStatusID";
DataAccess(Command: RadGrid.UpdateCommandName, Query: query, OrderStatusID: values["ID"].ToString());
}