2017-12-22 5 views
0

グルーピング行を含むグリッドビューのページがあります。 2番目のグリッドビューでajax経由で情報を更新すると、プラス、マイナスのボタンをクリックすると情報が更新されます。 プラスマイナスをクリックせずに2番目のグリッド内のデータを更新する方法はありますか?enter image description hereボタングルーピング行のあるページ

グリッドビューを別のグリッドビューで表示して閉じるコードです。 JS、負荷の 経由

$('.glyphicon-plus').click(function (event) { 
        if ($(this).hasClass("glyphicon-plus")) 
         $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>"); 
        else 
         $(this).closest("tr").next().remove(); 
        $(this).toggleClass('glyphicon-plus glyphicon-minus');}); 

コードGridViewの

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" Style="display: none" Visible="true"><ContentTemplate><asp:GridView ID="grdId" runat="server" AutoGenerateColumns="false" CssClass = "ChildGrid" Width="100%" OnRowDataBound="grdId_RowDataBound" HeaderStyle-HorizontalAlign="Center"><Columns></Columns> 
    </asp:GridView> 
    </ContentTemplate> 
    </asp:UpdatePanel> 

Ajaxの方法

var thisCell=this.value;var id=this.id; $.ajax({type: \"POST\",url: \"myPage.aspx/myMethod\",data: '{value:\"'+comment+'\",id:\"'+id+'\"}', 
    contentType: \"application/json; charset=utf-8\", 
    dataType: \"json\",success: function(response) {}}); 

答えて

0

解決の問題は、私は私のアーキテクチャのGridViewを変更するためのスクリプトを使用しています。

$('#MainContent_GridView > tbody > tr').each(function() { 
        var div1 = $(this).find('.hideGroup'); 
        $(this).find('.hideGroup').remove(); 
        var row = $('<tr>').append($('<td>')).append($('<td colspan = "999">').append(div1)); 
        $(row).insertAfter($(this).closest('tr')); 
       }); 

イベントのクリックコードが変更されました。

$('.glyphicon-plus').click(function (event) {var thisHG = $(this).closest("tr").next().find('.hideGroup'); 
        console.log(thisHG); 
        thisHG.toggle(); 
        $(this).toggleClass('glyphicon-plus glyphicon-minus'); 
} 
関連する問題