使用DataTables插件传递数据

时间:2019-05-07 22:41:14

标签: javascript vb.net datatables

我正在vb.net aspx页面上使用datatables查询插件,如何将在datatable上选择的数据传递回aspx.vb调用页面?

我已经阅读了datatables网站,但是我可以找到具体的内容

Example.aspx页面代码

<script type="text/javascript">

           $(document).ready(function () {

               $('#AllGames').DataTable({
                   "ajax": "../data/AllGames.json",
                   "type": "POST",
                   "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
               });

            var table = $('#AllGames').DataTable();

           $('#AllGames tbody').on( 'click', 'tr', function () {
                if ( $(this).hasClass('selected') ) {
                    $(this).removeClass('selected');
                }
                else {
                    table.$('tr.selected').removeClass('selected');
                    $(this).addClass('selected');
                }
               });

           //var table = $('#AllGames').DataTable();

             $('btnEnterScores').click( function() {
                 var data = table.$('input, select').serialize();
                 alert(
                    "The following data would have been submitted to the server: \n\n"+
                    data.substr( 0, 120 )+'...'
                );
                return false;
            } );

        });

    </script>

apsx.vb页面代码:

 Private Sub btnEnterScores_ServerClick(sender As Object, e As EventArgs) Handles btnEnterScores.ServerClick
        Dim lsSomething As String = ""

        Dim ref As String = Request.QueryString().ToString()

        Dim lsDataString = Session("data")


    End Sub

我希望能够读取数据,以便根据传递的数据来决定要采取的行动

0 个答案:

没有答案