user3601310
user3601310

Reputation: 873

How to make X-Scroll in a gridView asp.net?

I'm trying to add scroll bars in both x and y but I only can add y-scroll. At the moment, my gridview is showing only partial data, it is missing 3-4 columns so I really need to use x-scroll. I've tried "overflow-x: scroll;" but it doesn't work.

My source code

<div style= "overflow-x:scroll; Overflow:scroll; max-height: 150px; width: 800px">
                                                    <asp:GridView ID="GridViewUpBus" runat="server" AutoGenerateColumns="False" Font-Names="Arial" Font-Size="Small" HorizontalAlign="Center">
                                                        <Columns>
                                                            <asp:BoundField DataField="SubCatID" HeaderText="Sub category ID">
                                                            <ItemStyle Width="10%" />
                                                            </asp:BoundField>

If I run, it looks like this. 2 more columns are not showing enter image description here

Could it be achieved by not using javascript? If I need to use "jquery-1.4.1.js" or "gridviewScroll.min.js" where can I download it? Sorry I'm pretty new to programming and I don't really know how to use javascript or jquery. It'd be great if I could add boarder lines in the gridview. Thanks in advance!

Upvotes: 0

Views: 1991

Answers (1)

Jon P
Jon P

Reputation: 19772

CSS is case sensitive so Overflow wont work but overflow will. Try

<div style= "overflow:auto; max-height: 150px; width: 800px">

to only apply croll bars if needed or:

<div style= "overflow:scroll; max-height: 150px; width: 800px">   

to always have scrollbars.

Finally, avoid using inline style, apply it as a class instead.

Upvotes: 1

Related Questions