Hi,
I am trying to set the default value on 3 GridDropDownColumn's in an auto generated edit form. I have the following code in the grids item event (based on sample code). The problem is while this works correctly for text based fields the drop down lists are not set.
| protected void rgAppointments_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked |
| { |
| if (ViewState["LAST_APPOINTMENT"] != null) |
| { |
| AppointmentSave lstApp = (AppointmentSave)ViewState["LAST_APPOINTMENT"]; |
| e.Canceled = true; |
| //Prepare an IDictionary with the predefined values |
| System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary(); |
| newValues["staff_member_id"] = lstApp.StaffMember; |
| newValues["appointment_type_id"] = lstApp.AppointmentType; |
| newValues["location_id"] = lstApp.Location; |
| //Insert the item and rebind |
| e.Item.OwnerTableView.InsertItem(newValues); |
| } |
| } |
| } |
The version of the controls I am using is 2008.3.1125.20.
How do I get this to work or am I going to have to switch to a template to do this?
Thanks
Gavin