I have a nested RadGrid set up for In place editing. For simplicity there is an order header and order detail. The detail has editing capability and I can make it work but I need to update the order header after the detail is updated. So in the detail itemCommand I do the updates manually and then do a databind() on the header which properly updates the header but leaves the detail record in edit mode. If I remove the databind() then the detail record exits edit mode as desired but the header is not updated. Regardless of the databind the data is being updated in the database.
I have seen many threads regarding
- making sure e.canceled is not being set to true
- allowAutomaticUpdates is set to false
Is there a way after I do a databind() on the header to close the edit mode on the nested detail record?
Any and all help is appreciated
I have seen many threads regarding
- making sure e.canceled is not being set to true
- allowAutomaticUpdates is set to false
Is there a way after I do a databind() on the header to close the edit mode on the nested detail record?
Any and all help is appreciated
3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 06 Nov 2009, 05:48 AM
Hi,
A suggestion would be to use the AdvancedDataBinding technique for the update,insert operations of your grid. You can get more information on the same from the link below:
Grid / Advanced Data Binding
Thanks,
Shinu
A suggestion would be to use the AdvancedDataBinding technique for the update,insert operations of your grid. You can get more information on the same from the link below:
Grid / Advanced Data Binding
Thanks,
Shinu
0
Joel R
Top achievements
Rank 1
answered on 06 Nov 2009, 02:41 PM
I have put in place the advanced data binding but the order header record does not refresh after the detail record is changed. Is there something I need to do to request the update?
Below is the nested grid
Below is the nested grid
| <telerik:RadGrid ID="RadGridSummary" AllowFilteringByColumn="false" AllowPaging="False" AllowAutomaticUpdates='false' |
| runat="server" Width="100%" AutoGenerateColumns="False" |
| OnItemDataBound="RadGridSummary_ItemDataBound" OnNeedDataSource="RadGridSummary_NeedDataSource" OnDetailTableDataBind="RadGridSummary_DetailTableDataBind" |
| OnItemCommand="RadGridSummary_ItemCommand"> |
| <MasterTableView AutoGenerateColumns="false" AllowAutomaticUpdates='false' |
| Width='100%' DataKeyNames="SectionID" > |
| <DetailTables> |
| <telerik:GridTableView DataKeyNames="SectionID" EditMode="InPlace" |
| Width="100%" runat="server"> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="SectionID" MasterKeyField="SectionID" /> |
| </ParentTableRelation> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton"> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn HeaderText="AssessmentID" DataField="AssessmentID" UniqueName="AssessmentID" |
| Visible="false" ReadOnly="true" /> |
| <telerik:GridBoundColumn HeaderText="QuestionID" DataField="QuestionID" UniqueName="QuestionID" |
| Visible="false" ReadOnly="true" /> |
| <telerik:GridBoundColumn HeaderText="StdNo" DataField="StdNo" UniqueName="StdNo" |
| ReadOnly="true" /> |
| <telerik:GridBoundColumn HeaderText="StdShortWords" DataField="StdShortWords" UniqueName="StdShortWords" |
| ReadOnly="true" /> |
| <telerik:GridTemplateColumn HeaderText="Note" HeaderStyle-Width='60%' UniqueName="Note" |
| DataType="System.String" ItemStyle-BackColor="#ffffcc"> |
| <ItemTemplate> |
| <%# Eval("Note").toString() %> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:TextBox ID='TextBoxNote' runat="server" TextMode="MultiLine" Width='99%' Rows='3' |
| Text='<%# Bind("Note") %>'></asp:TextBox> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Score" HeaderStyle-Width='5%' UniqueName="Score"> |
| <ItemTemplate> |
| <%#IIf(Eval("Score").ToString() = "1", "C", IIf(Eval("Score").ToString() = "3", "P", "N"))%> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:RadioButtonList ID="rblSelection" runat="server" RepeatDirection="Horizontal" |
| SelectedValue='<%# Bind("Score") %>' BorderWidth="0" Width="100px"> |
| <asp:ListItem Value="1">C</asp:ListItem> |
| <asp:ListItem Value='3'>P</asp:ListItem> |
| <asp:ListItem Value="5">N</asp:ListItem> |
| </asp:RadioButtonList> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <NoRecordsTemplate> |
| No standards with notes</NoRecordsTemplate> |
| </telerik:GridTableView> |
| </DetailTables> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="AssessmentID" DataField="AssessmentID" UniqueName="AssessmentID" |
| Visible="false" /> |
| <telerik:GridBoundColumn DataField="SectionID" HeaderText='Section' /> |
| <telerik:GridBoundColumn DataField='MinimumScoreToPass' HeaderText='Minimum Score To Pass' /> |
| <telerik:GridBoundColumn DataField='Score' HeaderText='Score' /> |
| <telerik:GridBoundColumn DataField='Status' ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" |
| HeaderText='Status' /> |
| <telerik:GridBoundColumn DataField="SectionNoteCount" HeaderText='Note Count' /> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| Protected Sub RadGridSummary_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) |
| If e.CommandName = RadGrid.UpdateCommandName Then |
| Dim oDataAccess As New DataAccess |
| Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem) |
| Dim strQuestionID As String = (TryCast(editedItem("QuestionID").Controls(0), TextBox)).Text |
| Dim strScore As String = (TryCast(editedItem.FindControl("rblSelection"), RadioButtonList)).SelectedValue |
| Dim strNote As String = (TryCast(editedItem.FindControl("TextBoxNote"), TextBox)).Text |
| Dim strUserID As String = Session("UserID") |
| oDataAccess.AssessmentDetail_Update(ViewState("AssessmentID"), strQuestionID, strScore, strNote, strUserID) |
| oDataAccess.ScoreAssessment(ViewState("AssessmentID")) |
| End If |
| End Sub |
| Protected Sub RadGridSummary_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) |
| Dim oDataAccess As New DataAccess |
| DirectCast(source, RadGrid).DataSource = oDataAccess.getAssessmentSummary(ViewState("AssessmentID")) |
| End Sub |
| Protected Sub RadGridSummary_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) |
| Dim oDataAccess As New DataAccess |
| Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem) |
| Dim SectionID As String = dataItem.GetDataKeyValue("SectionID").ToString() |
| e.DetailTableView.DataSource = oDataAccess.GetAssessmentNotes(ViewState("AssessmentID"), SectionID) |
| End Sub |
0
Joel R
Top achievements
Rank 1
answered on 06 Nov 2009, 02:50 PM
I found a solution that works but the property "RequresBInding" is intended for Telerik internal use.
I added the line at the end of the item command
DirectCast
(source, RadGrid).MasterTableView.RequiresBinding = True