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

100% Height for grid

4 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 09 Sep 2008, 02:57 PM
I am trying to get the tfoot element of the grid to fill 100% of the parent container. I'm seeing some very odd behavior that I hope someone can help me with.

--------------------------ASPX------------------------------------

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server"><title></title></head>
<
body>
<form id="form1" runat="server" >
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" LoadScriptsBeforeUI="true">
</telerik:RadScriptManager>
<table cellpadding="0" cellspacing="0" border="1"bordercolor="red" width="100%" height="100%">
<tr><td valign="top" height="99%">
<telerik:RadGrid EnableEmbeddedSkins="false" ID="RadGrid1" ImagesPath="~/App_Themes/Theme1/Grid"
AllowPaging="true" AllowSorting="true" runat="server"
DataSourceID="XmlDataSource1" Skin="Sunset"
PageSize="5" PagerStyle-Position="Bottom" PagerStyle-AlwaysVisible="true" ><ClientSettings><Resizing EnableRealTimeResize="true" /></ClientSettings><MasterTableView Width="100%" Height="100%" ></MasterTableView></telerik:RadGrid></td></tr></table></form><asp:XmlDataSource ID="XmlDataSource1" DataFile="~/XMLFile1.xml" runat="server"></asp:XmlDataSource></body></html>


--------------------------CSS------------------------------------

html

,body,form{height:100%;width:100%;margin:0px;padding:0px;font-family: Verdana, Arial, sans-serif;color: #666666;background-color: #E5E5E5;}

/*paging*/

.GridPager_Sunset{background:#ded6c6;line-height:20px;height:100%;vertical-align:bottom;}

Any xml datasource will recreate the problem.

When this page loads...I have a scroll bar on the right hand said that is proportional to the amound of data in the grid. So if the grid had 10 records the browser right scroll shows and the page is about 30% longer then it shoudl be at. The paging is displayed off the screen.

Now I'm running at 1600X1200 RES so there is no reason there should be any scrolling on this page to show 10 records.

I just want the tfoot and paging to fill up the TD element 100% height.

4 Answers, 1 is accepted

Sort by
0
Craig
Top achievements
Rank 1
answered on 09 Sep 2008, 11:41 PM
I also noted when i removed the DOC TYPE def and removed the HTML element attribute the page behaved as I would expect.

REMOVED
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

CHANGED
<
html xmlns="http://www.w3.org/1999/xhtml" >
TO
<HTML>

I don't konw whatelse that would goof up. I think several of the other radcontrols are dependant on that information, but the tfoot element filled the parent TD container and the paging information was at the bottem of the page as I would have expected instead of way off the screen.

I'm using IE 7 on vista.
0
Dimo
Telerik team
answered on 10 Sep 2008, 07:22 AM
Hi Craig,

The behavior which you expect is supported by browsers only in quirks mode (backwards compliant mode), which is triggered when no DOCTYPE is present. In standards mode you will need to perform Javascript calculations to set the correct height to the pager.

Let us know if you decide to keep the DOCTYPE and need additional help with this scenario.

Regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Craig
Top achievements
Rank 1
answered on 10 Sep 2008, 02:57 PM
do you have an example of the javascript i would need to implement to correct this problem?

Assuming I leave the DOCTYPE.
0
Dimo
Telerik team
answered on 12 Sep 2008, 01:22 PM
Hello Craig,

We don't have an example, but here is one way to achieve what you want:


    <ClientSettings>
        <ClientEvents OnGridCreated="GridCreated" />
    </ClientSettings>


<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">

function GridCreated(sender, args)
{
    var mastertable = $get("<%= RadGrid1.ClientID %>_ctl00");
    if ($telerik.isFirefox)
    {
        mastertable.childNodes[4].childNodes[1].style.height = document.documentElement.offsetHeight - (mastertable.childNodes[3].offsetHeight + mastertable.childNodes[5].offsetHeight) - 6 + "px";
    }
    else
    {
        mastertable.childNodes[2].childNodes[0].style.height = document.documentElement.offsetHeight - (mastertable.childNodes[1].offsetHeight + mastertable.childNodes[3].offsetHeight) - 6 + "px";
    }
}

</script>
</telerik:RadCodeBlock>




All the best,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Craig
Top achievements
Rank 1
Answers by
Craig
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or