NET 与 VB.net。我想对列 dgv 表进行排序,但代码不起作用。
客户端是这样的
<asp:GridView ID="griddata" runat="server" AutoGenerateColumns="false" AllowSorting="True" >
<Columns >
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkStatus" runat="server" />
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%# eval("ID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="First_Name" HeaderText="First Name" SortExpression="First_Name"/>
<asp:BoundField DataField="Last_Name" HeaderText="Last Name" SortExpression="Last_Name" />
<asp:BoundField DataField="Address" HeaderText="Address" />
<asp:BoundField DataField="Phone" HeaderText="Phone" />
</Columns>
</asp:GridView>
服务器端是这样的
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.IO
Partial Public Class Course
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
listhendle()
End Sub
Protected Sub listhendle()
Dim ds As New DataSet
Dim cls As New connections
ds = cls.returndataset("select * from [m.student] ")
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
End Class
我错过了什么吗?我从这里得到了参考,我改变了数据连接