怎么在gridview 的列做一个超连接?
4个回答
展开全部
可以仿照以下代码实现:
<asp:GridView ID="sms_student" runat="server" AutoGenerateColumns="False"
DataKeyNames="Sno" HorizontalAlign="Center" OnPageIndexChanging="Data_Page"
Width="760px" AllowPaging="True">
<HeaderStyle BackColor="Gold" Font-Bold="True" Font-Size="Small" />
<FooterStyle BackColor="Tan" />
<Columns>
<asp:TemplateField HeaderText="学号" SortExpression="Cno">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/Images/e.jpg" NavigateUrl='<%# Eval("Sno", "Editstu.aspx?id={0}") %>'
Text="学号"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle Font-Size="Small" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFC0C0" BorderColor="#C0C0FF" />
<PagerStyle HorizontalAlign="Center" />
<PagerTemplate>
<table>
<tr>
<td>
<asp:Label ID="LabelCurrentPage" runat="server" Font-Size="Small">绞珜ㄩ<%# ((GridView)Container.NamingContainer).PageIndex + 1 %></asp:Label></td>
<td>
<asp:Label ID="LabelPageCount" runat="server" Font-Size="Small">軞珜杅ㄩ<%# ((GridView)Container.NamingContainer).PageCount %></asp:Label></td>
<td>
<asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>" Font-Size="Small">忑珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev"
CommandName="Page" Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>"
Font-Size="Small">奻珨珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"
Font-Size="Small">狟珨珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"
Font-Size="Small">帣珜</asp:LinkButton></td>
</tr>
</table>
</PagerTemplate>
<AlternatingRowStyle BackColor="WhiteSmoke" />
</asp:GridView>
<asp:GridView ID="sms_student" runat="server" AutoGenerateColumns="False"
DataKeyNames="Sno" HorizontalAlign="Center" OnPageIndexChanging="Data_Page"
Width="760px" AllowPaging="True">
<HeaderStyle BackColor="Gold" Font-Bold="True" Font-Size="Small" />
<FooterStyle BackColor="Tan" />
<Columns>
<asp:TemplateField HeaderText="学号" SortExpression="Cno">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/Images/e.jpg" NavigateUrl='<%# Eval("Sno", "Editstu.aspx?id={0}") %>'
Text="学号"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle Font-Size="Small" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFC0C0" BorderColor="#C0C0FF" />
<PagerStyle HorizontalAlign="Center" />
<PagerTemplate>
<table>
<tr>
<td>
<asp:Label ID="LabelCurrentPage" runat="server" Font-Size="Small">绞珜ㄩ<%# ((GridView)Container.NamingContainer).PageIndex + 1 %></asp:Label></td>
<td>
<asp:Label ID="LabelPageCount" runat="server" Font-Size="Small">軞珜杅ㄩ<%# ((GridView)Container.NamingContainer).PageCount %></asp:Label></td>
<td>
<asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>" Font-Size="Small">忑珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev"
CommandName="Page" Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>"
Font-Size="Small">奻珨珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"
Font-Size="Small">狟珨珜</asp:LinkButton></td>
<td>
<asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"
Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"
Font-Size="Small">帣珜</asp:LinkButton></td>
</tr>
</table>
</PagerTemplate>
<AlternatingRowStyle BackColor="WhiteSmoke" />
</asp:GridView>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我整理的文章, 希望可以帮到你(绝对不坑爹)
http://hi.baidu.com/superfiresun/blog/item/58d842e3a95f42ca2e2e21de.html
http://hi.baidu.com/superfiresun/blog/item/58d842e3a95f42ca2e2e21de.html
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
学习
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询