gridview 分页 下面的页码太紧密了,怎么调样式啊
2012-04-10 · 知道合伙人互联网行家
zhuxinjun1982
知道合伙人互联网行家
向TA提问 私信TA
知道合伙人互联网行家
采纳数:2145
获赞数:8329
毕业于上海行健职业学院,大专学历;2007~2009在北大青鸟进修网络编程课目。现任网络主管,平时爱好上网。
向TA提问 私信TA
关注
展开全部
<asp:GridView ID="GridView1" runat="server" CellPadding="3" CellSpacing="5" >
CellPadding:此属性是调整列空白之间的间距
CellSpacing:此属性是调整列字体之间的间距
以下是我的代码:你可以参考下
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="5" DataSourceID="ObjectDataSource1" GridLines="Horizontal" PageSize="15"
Width="946px">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<Columns>
<asp:BoundField DataField="NewsId" HeaderText="NewsId" SortExpression="NewsId" Visible="False" />
<asp:BoundField DataField="CategoryId" HeaderText="CategoryId" SortExpression="CategoryId"
Visible="False" />
<asp:BoundField DataField="Title" HeaderText="标题" SortExpression="Title">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="CategoryName" HeaderText="所属分类" SortExpression="CategoryName">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Content" HeaderText="Content" SortExpression="Content"
Visible="False" />
<asp:BoundField DataField="Img" HeaderText="Img" SortExpression="Img" Visible="False" />
<asp:BoundField DataField="CreateDate" DataFormatString="{0:yy-MM-dd}" HeaderText="发布日期"
SortExpression="CreateDate">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:TemplateField HeaderText="查看详情">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" Target="_parent" runat="server" NavigateUrl='<%# "news.aspx?id="+ Eval("NewsId") %>'
ForeColor="Blue">查看</asp:HyperLink>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllNews"
TypeName="wnBLL.newsBLL">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="categoryId" QueryStringField="categoryId"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
CellPadding:此属性是调整列空白之间的间距
CellSpacing:此属性是调整列字体之间的间距
以下是我的代码:你可以参考下
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="5" DataSourceID="ObjectDataSource1" GridLines="Horizontal" PageSize="15"
Width="946px">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<Columns>
<asp:BoundField DataField="NewsId" HeaderText="NewsId" SortExpression="NewsId" Visible="False" />
<asp:BoundField DataField="CategoryId" HeaderText="CategoryId" SortExpression="CategoryId"
Visible="False" />
<asp:BoundField DataField="Title" HeaderText="标题" SortExpression="Title">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="CategoryName" HeaderText="所属分类" SortExpression="CategoryName">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Content" HeaderText="Content" SortExpression="Content"
Visible="False" />
<asp:BoundField DataField="Img" HeaderText="Img" SortExpression="Img" Visible="False" />
<asp:BoundField DataField="CreateDate" DataFormatString="{0:yy-MM-dd}" HeaderText="发布日期"
SortExpression="CreateDate">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:TemplateField HeaderText="查看详情">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" Target="_parent" runat="server" NavigateUrl='<%# "news.aspx?id="+ Eval("NewsId") %>'
ForeColor="Blue">查看</asp:HyperLink>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllNews"
TypeName="wnBLL.newsBLL">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="categoryId" QueryStringField="categoryId"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
博思aippt
2024-07-20 广告
2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |