开发者

GridView paging problem!

I enabled paging in my 开发者_如何学运维gridview. It pages normally, but when I display 3 items instead of 10, the rows height changes proportionally to suit the gridview height. How can I make the rows be in fixed height! no matter how many items i have on a particular page in Gridview


You can set the row height by setting RowStyle-Height within the GridView tag itself.. Also you can set the styles of each cell including the header cell by setting attributes in each TemplateField (ItemStyle-Height etc). see the code below,

<asp:GridView ID="gvwID" runat="server" AutoGenerateColumns="false" 
    RowStyle-Height="50"  Width="100%">
    <Columns>
        <asp:TemplateField ItemStyle-Height="50"  HeaderStyle-Height="110" 
            HeaderText="Releases" ItemStyle-VerticalAlign="Top" >
            <ItemTemplate>
                //data binding section
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Hope this helps you...


Don't specify a height for the gridview.

If your rows are larger from columns which have a lot of text, then use maybe something like this around your content:

<div style="overflow-y:scroll; width: 200px; height: 100px;">
    <%# Eval("ColumnName") %>
</div>

Better to move into a css class instead of style but that is basically what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜