Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 排序datagrid表时出错_Asp.net_Vb.net - Fatal编程技术网

Asp.net 排序datagrid表时出错

Asp.net 排序datagrid表时出错,asp.net,vb.net,Asp.net,Vb.net,单击时,我尝试对datagrid列进行排序,结果显示以下错误消息: System.IndexOutOfRangeException:找不到列ibsn 该代码对其他列运行良好。我不太确定我错在哪里了 Sub Sort_Grid(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs) if Session("MyCurrentSort") = e.SortExpression then Session(

单击时,我尝试对datagrid列进行排序,结果显示以下错误消息:

System.IndexOutOfRangeException:找不到列ibsn

该代码对其他列运行良好。我不太确定我错在哪里了

Sub Sort_Grid(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
    if Session("MyCurrentSort") = e.SortExpression then
        Session("MyCurrentSort") = e.SortExpression & " desc"
    else
        Session("MyCurrentSort") = e.SortExpression
    end if
    BindGrid()
End Sub

我认为错误不会发生在你写的代码中。我假设ibsn列不存在。它可能是另一个名称。在数据网格中,当它应该是SortExpression=“isbn”时,我使用了SortExpression=“isbn”