Folks,
I am trying to retain the values in a detail grid after a griddropdowncolumn event fire (selectedindexchanged event ). I am extracting the values (current cell values) of the grid in a session variable and changing some properties for a column depending on the selected value in dropdown in the selectedindexchanged event (then I am rebinding the grid to see the effects of changed properties). Then in grid prerender event I am trying to set the cell values from the session variable, Here comes the problem, I am unable to find the detail grid items to set the cell values.
I am binding the grid on the server (using needdatasource event and detailtablebind events).
For your reference, I have included my selectedindexchanged event and grid prerender events here
| Private Sub List_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) |
| Dim editedItem As GridEditableItem = CType(CType(sender, RadComboBox).NamingContainer, GridEditableItem) |
| Dim ddlChsnMthd As RadComboBox = CType(editedItem("CHSN_MTHD_ID").Controls(0), RadComboBox) |
| Dim insertItem As GridDataItem = DirectCast(CType(sender, RadComboBox).NamingContainer, GridDataItem) |
| Dim insertVals As Hashtable = New Hashtable |
| RadGrid1.MasterTableView.ExtractValuesFromItem(insertVals, insertItem) |
| Session("insertvals") = insertVals |
| If ddlChsnMthd.SelectedValue = 4 Then |
| RadGrid1.MasterTableView.DetailTables.Item(0).Columns.Item(9).Visible = True |
| Else |
| RadGrid1.MasterTableView.DetailTables.Item(0).Columns.Item(9).Visible = False |
| End If |
| RadGrid1.MasterTableView.Rebind() |
| End Sub |
| Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender |
| If Not Session("insertvals") Is Nothing AndAlso RadGridTransCalc.MasterTableView.DetailTables.Item(0).IsItemInserted Then |
| Dim insertvals As Hashtable = CType(Session("insertvals"), Hashtable) |
| Dim insertItem As GridEditableItem = DirectCast(RadGridTransCalc.MasterTableView.DetailTables.Item(0).GetInsertItem(), GridEditableItem) |
| If Not insertvals("ID") Is Nothing Then TryCast(insertItem("ID").Controls(0), RadComboBox).SelectedValue = insertvals("ID") |
| If Not insertvals("CALC_DATE") Is Nothing Then TryCast(insertItem("CALC_DATE").Controls(0), RadDatePicker).SelectedDate = CDate(insertvals("CALC_DATE")) |
| If Not insertvals("STRT_TIME") Is Nothing Then TryCast(insertItem("STRT_TIME").Controls(0), RadTimePicker).SelectedDate = CDate(insertvals("STRT_TIME")) |
| If Not insertvals("END_TIME") Is Nothing Then TryCast(insertItem("END_TIME").Controls(0), RadTimePicker).SelectedDate = CDate(insertvals("END_TIME")) |
| If Not insertvals("COND_ID") Is Nothing Then TryCast(insertItem("COND_ID").Controls(0), RadComboBox).SelectedValue = insertvals("COND_ID") |
| If Not insertvals("MTHD_ID") Is Nothing Then TryCast(insertItem("MTHD_ID").Controls(0), RadComboBox).SelectedValue = insertvals("MTHD_ID") |
| End If |
| End Sub |
Does anyone came across this scenario, please help.
Thanks,
Kevin