Solved

GridView width and height - ASP.net

Posted on 2006-07-20
4
6,642 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

832 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