Solved

GridView Row Height

Posted on 2010-11-28
10
600 Views
Last Modified: 2012-05-10
I have a gridview and a style defined below. The gridview is bound to a dataset dynamically. Although I have set .gridstyle in GridView, the grid row height is still changable, because some columns contains multpiple words and the worlds can be displayed one word a line. This gridview is only for displaying and without add/edit/delete functionalities.

How can I fix the height of each row? Where should I put .gridstyle to fix the cell height?

    <style type="text/css">
       
        .gridstyle { height: 20px; }

    </style>

<asp:GridView ID="GridView2" runat="server" BackColor="#FFFFFF" CssClass ="gridstyle"
                    ForeColor="#5078B3" BorderStyle="Solid" BorderColor="#5078B3" >                   
          <headerstyle backcolor="#BF88FE"  forecolor="#5078B3"/>
          <footerstyle backcolor="#BF88FE"  forecolor="#3A5FCD"/>                
          <PagerStyle HorizontalAlign="Center" />                    
           <AlternatingRowStyle BackColor="#F0F0F0" />
</asp:GridView>
0
Comment
Question by:minglelinch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 34226614
You can try

<asp:GridView ID="GridView2" runat="server" BackColor="#FFFFFF" CssClass ="gridstyle"
                    ForeColor="#5078B3" BorderStyle="Solid" BorderColor="#5078B3" >     
           <RowStyle  Height="20px" Wrap="false" />              
          <headerstyle backcolor="#BF88FE"  forecolor="#5078B3"/>
          <footerstyle backcolor="#BF88FE"  forecolor="#3A5FCD"/>                
          <PagerStyle HorizontalAlign="Center" />                    
           <AlternatingRowStyle BackColor="#F0F0F0" />
</asp:GridView>
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 34226909
Use CssClass  to call css:
<asp:GridView ID="GridView2" runat="server" BackColor="#FFFFFF" CssClass ="gridstyle"
                    ForeColor="#5078B3" BorderStyle="Solid" BorderColor="#5078B3" >     
           <RowStyle  CssClass="gridstyle" />              
          <headerstyle backcolor="#BF88FE"  forecolor="#5078B3"/>
          <footerstyle backcolor="#BF88FE"  forecolor="#3A5FCD"/>                
          <PagerStyle HorizontalAlign="Center" />                    
           <AlternatingRowStyle BackColor="#F0F0F0" />
</asp:GridView>
0
 
LVL 1

Author Comment

by:minglelinch
ID: 34227188
I tried <RowStyle  Height="20px" Wrap="false" /> , it's not working. Any other ways?
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 1

Author Comment

by:minglelinch
ID: 34227202
I just tried <RowStyle  CssClass="gridstyle" />, it's still not working. Any other way? Thanks.
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 34227552
My code works OK in my sample page. Is the style below defined on the HEAD section of your page?
<HEAD>
  <style type="text/css">
       
        .gridstyle { height: 20px; }

    </style>
</HEAD>
also, Is the gridstyle name unique?
0
 
LVL 1

Author Comment

by:minglelinch
ID: 34239012
Yes, it's in head section and it's unique. Most rows are fine, except rows having multiple words in a cell shows higher size, as the multiple words take two or three lines.
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 36119197
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 36119198
I'll post the answer.
0
 
LVL 1

Author Closing Comment

by:minglelinch
ID: 36119200
THanks for the comment
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

617 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