开发者

how to scroll the gridview rows without scrolling header names in asp.net?

i am using asp.net2.0 , in my project using one gridview in that gridview number of rows are there so i am using the 开发者_StackOverflowpanel and inside the panel past the gridview and write the code like this

<asp:Panel ID="Panel1" runat="server" Height="100px" Width="550px" ScrollBars="Vertical" style="margin:0px 0 0 80px;" Visible="False">
<asp:GridView ID="grdCustomerInvoices" runat="server" AutoGenerateColumns="False" >
--
----
</asp:GridView>
</asp:Panel>

above code scrolling the header titles also but i have header names are constant(not scrolling) and rows only scrolling . pls help me any one

thank u hemanth


I would suggest you use third party control which supports this.

There is not easy way of doing this. I had doen this few years ago, I dont have sample code. But in item_databound event, check that the header row is written, and before the first item row is created insert a Div tag and after the last item row is created end the Div tag.set the autoscroll and size of the div as per your taste. I have done this in past and it works. unfortunately I dont have code for this.

another way to do is create images of the column headers and place the grid right below it. hide the header row of the grid. but this is not a scalable solution.


No need for any Third party controls if your requirement is only this.

Third party controls like 'RadGrid' of 'Telerik' offer various other things like additional Client-Side events and other Design advantages. If your requirement is so intense that you need those features go for it.

Else if your requirement is only a Static Header, refer to the article that I have posted in the below link, http://www.codeproject.com/Tips/602934/Static-Grid-Header

It accomplishes the task using only Css.


Try this:

<div style="overflow: auto; width: 200px; height: 200px">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜