ASP.net gridviewallowsorting不会在标题中创建超链接
本文关键字:标题 创建 超链接 net gridviewallowsorting ASP | 更新日期: 2023-09-27 18:17:09
我想在自定义数据绑定GridView上实现自定义排序。OnSorting已经实现,我已经知道,我需要修改,使排序工作。不幸的是,由于某些原因,当我运行页面时,它没有在标题上创建超链接,以便点击以触发事件:
<asp:GridView ID="dgEnrollmentTracker" runat="server" AllowPaging="True" OnSorting="dgEnrollmentTracker_Sorting"
AllowSorting="True" AutoGenerateColumns="False" EnableModelValidation="True"
Font-Size="8.5pt" Width="1930px" Font-Names="verdana,tahoma,sans-serif">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Name URL" DataTextField="Name"
HeaderText="Name" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:HyperLinkField>
<asp:BoundField DataField="Site ID" HeaderText="Site ID" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="S Date" HeaderText="S Date" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="P Initials" HeaderText="P Initials" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="PID" HeaderText="PID" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Type" HeaderText="Type" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Eligibility" HeaderText="Eligibility" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Ent Date Mailed" HeaderText="Ent Date Mailed" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="PReached" HeaderText="PReached" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Ento Date Mailed" HeaderText="Ento Date Mailed" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="EDate" HeaderText="EDate" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="DoS" HeaderText="DoS" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="125px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="BSC" HeaderText="BCS" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="SC" HeaderText="SC" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="75px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Modified" HeaderText="Modified" >
<HeaderStyle HorizontalAlign="Left" Font-Bold="False" />
<ItemStyle Width="165px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Modified By" HeaderText="Modified By" >
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle Width="225px" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Created" HeaderText="Created" >
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle Width="165px" HorizontalAlign="Left" />
</asp:BoundField>
</Columns>
<PagerStyle BorderStyle="None" HorizontalAlign="Center"
VerticalAlign="Middle" />
</asp:GridView>
查看sortexpression
属性
`<asp:BoundField DataField="PReached" HeaderText="PReached"
SortExpression="PReached" ReadOnly="True" />`