I have one grid view in my web application. I use the following code
<asp:GridView ID="dataGrid" runat="server" AllowPaging="True"
AutoGenerateColumns="True" BorderColor="Black" BorderWidth="1px"
CellPadding开发者_JAVA百科="4" EnableSortingAndPagingCallbacks="true" Font-Underline="False"
ForeColor="#333333" HorizontalAlign="Left" PageSize="10" RowStyle-Width="20"
Width="421px">
<RowStyle BackColor="#EFF3FB" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" Font-Underline="true"
ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White"
HorizontalAlign="Left" />
<EditRowStyle BackColor="#2461BF" HorizontalAlign="Left" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
I want when i executing that code which displays the pagenumber should be underlined in grid view. Can anyone able to help for that. Thanx in advance...
Very simple, use PagerStyle
<PagerStyle Font-Underline="true" />
Here's a link to show how to use the PagerStyle tag in context: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagerstyle.aspx
Here's information on what all the style properties you can use for PagerStyle. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.tableitemstyle.aspx
I recommend you use the CssClass property to set the font to be underlined using css like
<PagerStyle CssClass="PagerControl">
.PagerControl {
text-decoration: underline;
}
Since the current page is under a span tag <span>1</span>
you could do something like this:
On your CSS, add a class that extends to span
element, add this to your class text-decoration:underline !important;
(!important is so that it's not overridden) and then call that CSS class on your GridView's PagerStyle
Example:
CSS class:
.gvPager span {
text-decoration:underline !important;
}
GridView:
<asp:GridView runat="server">
<PagerStyle CssClass ="gvPager" />
</asp:GridView>
精彩评论