开发者

Gridview problem with the rows autosizing

Basically my rows autosize depending on the number of items it has. If it has one item then,,the header, pager, are all in a big size.

How could I make the header and footer fixed,, and may be insert a few empty rows not to extend the item..

I tried to do so with the page change event..but not very successfully so i need help..

This is what i thought of so far:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    if (this.GridView1.Rows.Count < this.GridView1.PageSize)
    {
        foreach (GridViewRow tt in GridView1.Rows)
        { tt.Height = Unit.Pixel(30); }

    }
}

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
    if (thi开发者_JAVA百科s.GridView1.Rows.Count < this.GridView1.PageSize)
    {
        foreach (GridViewRow tt in GridView1.Rows)
        { tt.Height = Unit.Pixel(30); }

    }
}


Give CSS for your Gridview, and mainly for your (ie CSS) Gridviews Headerstyle and Rowstyle Properties.


Can you try with stylesheet. Let say if only one record apply one CSS Style other vise normal style. I think that is possible.
Let me know if you need more help on this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜