Solved

GridView width and height - ASP.net

Posted on 2006-07-20
4
6,640 Views
Last Modified: 2012-08-13
Hi,

I have got this simple Grid:
            <asp:GridView ID="ExcelGrid" runat="server"  RowStyle-Wrap="false" CellPadding="4" ForeColor="#333333" GridLines="None">
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Wrap="False" />
                <EditRowStyle BackColor="#999999" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>

But when I display the page, it autosizes itself. I want to define width and height for this GridView. If data is more than they will have to scroll left or down to see it.

So how i can set width and height for this grid view.

Regards
0
Comment
Question by:radhakrishan
  • 2
4 Comments
 
LVL 6

Expert Comment

by:e1v
ID: 17145088
Gridview have widht and height properties, like

<asp:GridView ID="ExcelGrid" runat="server"  RowStyle-Wrap="false" CellPadding="4" ForeColor="#333333" GridLines="None" Height="300" Width="500">
....
0
 

Author Comment

by:radhakrishan
ID: 17145143
I have tried this, but doesn't seem to work.

GridView still autosizes itself to full width and height (not to what I mentioned).

Any more advise or do you think Im doing anything wrong. I have developed my project by using TIME TRACKER starter kit (available from asp.net website)

Regards
0
 
LVL 6

Expert Comment

by:e1v
ID: 17145215
Sounds like it might be a skinfile or a css stylesheet that overrides your settings (look under the App_Themes folder for .skin files)

Try to view the page without using themes (remove the Theme=".." from the <%@ Page directive)
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 17145226
Try this with div tag

<div style="height:200px; width:500px; overflow:scroll;"  >
 <asp:GridView ID="ExcelGrid" runat="server"  RowStyle-Wrap="false" CellPadding="4" ForeColor="#333333" GridLines="None">
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Wrap="False" />
                <EditRowStyle BackColor="#999999" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>

</div>

hope this helps u :)
thanx
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question