This is a migrated thread and some comments may be shown as answers.

[Solved] Unwanted Whitespace Appears When ScrollHeight Set

3 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 17 Mar 2013, 04:52 PM
I'm transitioning from using Microsoft's GridView to using Telerik's RadGrid.  With the former, to achieve vertical scrolling I just had a parent DIV with the correct properties set to achieve it.  The approach worked fine except that the header also scrolled, which I didn't like.

So now I'm trying to use the supposedly simpler, "automated" functionality that RadGrid offers but am running into countless problems.  Here's some sample layout code:
<telerik:RadGrid ID="radGridSummary" runat="server" AutoGenerateColumns="false" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1" Width="587px"
                 CellPadding="0" GridLines="Both" Font-Size="11px" OnItemDataBound="radGridSummary_ItemDataBound" OnItemCommand="radGridSummary_ItemCommand">
  <HeaderStyle Font-Bold="true" ForeColor="#031d5b" VerticalAlign="Middle" Height="20" CssClass="pointerOnly headerGridRB" />
  <ItemStyle CssClass="radGridItem" />
  <AlternatingItemStyle CssClass="radGridAltItem" />
  <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true" Scrolling-UseStaticHeaders="true" Scrolling-AllowScroll="true" Scrolling-ScrollHeight="200px" />
Note the last 3 properties of "ClientSettings" to turn on the vertical scrolling.  In a separate posting I pointed out that this messed up the horizontal alignment of the grid items in relation to the text in the header.  I'm still awaiting a solution to that.

Now I've discovered that when the available space of the grid isn't fully populated that an ugly white space appears.  This is clearly unacceptable.  How do I get rid of or hide that white space?

Robert

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Mar 2013, 04:48 AM
Hi,

Try setting height and width properties as shown below.
aspx:
<MasterTableView Height="800px" Width="2000px"></MasterTableView>
   <ClientSettings><Scrolling AllowScroll="true" /></ClientSettings>

Thanks,
Shinu
0
Robert
Top achievements
Rank 1
answered on 18 Mar 2013, 04:02 PM
Shinu, as per your instructions, I just explicitly set the width & height in the MasterTableView:
<telerik:RadGrid ID="radGridSummary" runat="server" AutoGenerateColumns="false" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1" Width="587px"
                 CellPadding="0" GridLines="Both" Font-Size="11px" OnItemDataBound="radGridSummary_ItemDataBound" OnItemCommand="radGridSummary_ItemCommand">
  <HeaderStyle Font-Bold="true" ForeColor="#031d5b" VerticalAlign="Middle" Height="20" CssClass="pointerOnly headerGridRB" />
  <ItemStyle CssClass="radGridItem" />
  <AlternatingItemStyle CssClass="radGridAltItem" />
  <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true" Scrolling-UseStaticHeaders="true" Scrolling-AllowScroll="true" Scrolling-ScrollHeight="200px" />
 
  <MasterTableView Width="587px" Height="200px" BorderWidth="0" DataKeyNames="TaskID, TaskLevel, TaskActivity">

As you'll see in my enclosed screenshot, that made things much worse.

FYI here are my GridList related CSS classes:
/*** RadGrid CSS Classes - Used in GeneralInfo & gridListRB ***/
 
div.gridRB
{
  margin-top:15px;
  margin-right:6px;
  padding:0 0 0 0;
  overflow-x:hidden;
  overflow-y:auto;
  max-height:250px;
  border:solid 1px Gray;
}
 
.headerGridRB
{
  background-color:#bcd0fe !important;
  background-image:none !important;
  padding-top:2px !important;
  padding-bottom:2px !important;
}
 
div.RadGrid .rgRow td
{
  border-bottom-width:0;
  padding-top:0;
  padding-bottom:0;
}
 
div.RadGrid .rgAltRow td
{
  border-top-width:0;
  border-bottom-width:0
  padding-top:0;
  padding-bottom:2px;
}
 
div.RadGrid .radGridItem
{
  background-color:#9999a5;
  color:#020f30;
  font-weight:normal;
  height:20px;
  cursor:pointer;
}
 
div.RadGrid .radGridAltItem
{
  background-color:#c7c7cd;
  font-weight:normal;
  height:18px;
  cursor:pointer;
}
 
div.RadGrid_Default .rgHoveredRow
{
    background-color:#bcd0fe !important;
    background-image:none !important;
}
 
/*** End of RadGrid CSS Classes ***/
0
Pavlina
Telerik team
answered on 22 Mar 2013, 07:42 AM
Hi,

Try to remove the Height property from MasterTableView and see if it makes any difference.
<MasterTableView Width="587px" BorderWidth="0" DataKeyNames="TaskID, TaskLevel, TaskActivity">

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Robert
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or