Solved

GridView width and height - ASP.net

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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