0

MasterTableView と DetailView を含む RadGrid を使用しています。DetailView 行の削除時に MasterTableView に存在する小計の値を変更しようとしています。親テーブルでコントロールを取得でき、値を変更できます。ただし、値は反映されません。Rebind() メソッドや e.Item.OwnerTableView.DataBind() など、複数のオプションを試しました。ここに私の ItemCommand 関数がどのように見えるかがあります

    Private Sub dbgView_ItemCommand(ByVal source As System.Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles dbgView.ItemCommand
            If e.CommandName.ToLower.Equals(GlobalConstants.Key_Delete_CommandName) And e.Item.OwnerTableView.Name = "Tax" Then
                   dataItem = DirectCast(e.Item.OwnerTableView.ParentItem, GridDataItem)
                   Dim numSubTotal As NumericBox = dataItem.FindControl("numAmount")
                   numSubTotal.Text = "New Value"
                   ' e.Item.OwnerTableView.DataBind()
            End If

新しい値が反映されない理由を誰かが理解するのを手伝ってくれますか? ここに私のグリッドがどのように見えるかがあります

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="dbgView">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="dbgView"></telerik:AjaxUpdatedControl>
                           </telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadGrid ID="dbgView" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                PageSize="5" GridLines="Horizontal" Skin="Office2010Blue" Style="border: 0 none"
                AllowAutomaticInserts="True">
                <PagerStyle Mode="NumericPages"></PagerStyle>
                <MasterTableView Width="100%" CommandItemDisplay="Top" Name="GLLine" AllowNaturalSort="False"
                    PageSize="10" DataKeyNames="Key" NoDetailRecordsText="No records to display.">
                    <DetailTables> .....

更新 さらに掘り下げると、操作が実行された後にグリッドを再バインドする必要があることがわかりました。ただし、再バインドを実行しているときに例外が発生します

[HttpException (0x80004005): DataBinding: 'System.Collections.DictionaryEntry' には 'TaxID' という名前のプロパティが含まれていません。] System.Web.UI.DataBinder.GetPropertyValue(オブジェクト コンテナー、文字列 propName) +384 Telerik.Web. UI.GridTableView.PopulateDataKey(オブジェクト dataItem、DataKey キー、文字列名) +457 Telerik.Web.UI.GridTableView.PopulateDataKeys(オブジェクト dataItem) +241

ただし、通常の操作ではこの問題は発生しません。それ以外の場合は、すべての通常の操作でこのデータキーを見つけることができます。何がうまくいかないのですか?

更新 Telerik からの以下のリンクによると、詳細テーブルの行が削除された場合、マスター テーブルは更新されません。

http://www.telerik.com/forums/master-grid-not-rebinding-after-detail-table-delete-command

このウェブサイトに記載されているとおりに再バインドしようとしています。ただし、上記のように DataKeyValues の例外が発生しています。どんなポインタでも本当に役に立ちます。

4

1 に答える 1