Solved

GridView width and height - ASP.net

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now