简单的论坛文章标题列表gridview应用(超链接)
<a href="newpost.aspx"> </a>
<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Width="676px">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="postid" InsertVisible="False" ReadOnly="True" SortExpression="postid" />
<asp:HyperLinkField DataNavigateUrlFields="postid" DataNavigateUrlFormatString="message.aspx?postid={0}"
DataTextField="subject" HeaderText="主题" />
<asp:BoundField DataField="posttime" HeaderText="发表时间" SortExpression="posttime" />
<asp:BoundField DataField="username" HeaderText="作者" SortExpression="username" />
<asp:BoundField DataField="views" HeaderText="浏览数" SortExpression="views" />
<asp:BoundField DataField="replies" HeaderText="回复数" SortExpression="replies" />
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SimpleBBSConnectionString %>"
SelectCommand="SELECT newpost.postid, users.id, newpost.subject, newpost.posttime, newpost.userid, newpost.replies, newpost.views, users.username FROM newpost INNER JOIN users ON newpost.userid = users.id ORDER BY newpost.posttime DESC">
</asp:SqlDataSource>

浙公网安备 33010602011771号