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

Radgrid static header problem

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Satyajit
Top achievements
Rank 1
Satyajit asked on 07 Mar 2012, 02:51 PM
Hi,
I am using radgrid with static header,but it gives me problem when web page resizing.
Radgrid width has not adjusted according to page size.When page has refreshed then only width has adjusted

 Below are the code,

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="frmIRPage.aspx.cs" Inherits="Dummy"%>

 

<%

@ Register TagPrefix="Acme" Namespace="Acme" Assembly="App_Web_mytestuc.ascx.cdcab7d2" %>

 

<%

@ Register Assembly="ContainerControl" Namespace="Tittle.Controls" TagPrefix="Tittle" %>

 

<%

@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

 

 

<!

 

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>

 

 

<link href="/css/DMStyleSheet.css" type="text/css" rel="Stylesheet" />

 

 

<link href="/css/style.css" type="text/css" rel="Stylesheet" />

 

 

<script src="JQuary/jquery.js" type="text/javascript"></script>

 

 

<script src="JQuary/progress.js" type="text/javascript"></script>

 

 

<script src="Javascript/Leftpan.js" type="text/javascript"></script>

 

 

<link rel="stylesheet" href="Styles/demo/base/jquery.ui.all.css" type="text/css" />

 

 

<script src="JQuary/jquery-1.7.1.js" type="text/javascript"></script>

 

 

<script src="JQuary/ui/jquery.ui.core.js" type="text/javascript"></script>

 

 

<script src="JQuary/ui/jquery.ui.widget.js" type="text/javascript"></script>

 

 

<script src="JQuary/ui/jquery.ui.accordion.js" type="text/javascript"></script>

 

 

<link rel="stylesheet" href="Styles/demo/demos.css" type="text/javascript" />

 

 

<link href="Styles/demo/base/jquery.ui.theme.css" rel="stylesheet" type="text/css" />

 

 

<link href="css/Grid.MyCustomSkin.css" rel="stylesheet" type="text/css" />

 

<%

-- <script src="Javascript/TableHeightWidth.js" type="text/javascript"></script>--%>

 

 

<script type="text/javascript">

 

$(

function () {

 

$(

"#accordion").accordion({

 

collapsible:

true

 

});

});

 

</script>

 

 

<style type="text/css">

 

 

.style1

 

{

 

width: 47%;

 

}

 

 

.RadPanelBar .rpImage

 

{

 

height: 19px;

 

}

 

.RadPanelBar .rpLevel1 .rpImage

 

{

 

height: 16px;

 

}

 

</style>

 

 

<script type="text/javascript">

 

 

 

 

 

function funSetWidthHeight(id, id2, id3, idV,Img4, iWidth, iHeight) {

 

// debugger;

 

var myWidth = 0;

 

 

var myHeight = 0;

 

 

if (typeof (window.innerWidth) == 'number') {

 

 

//Non-IE

 

myWidth = window.innerWidth;

myHeight = window.innerHeight;

}

 

if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {

 

 

//IE 6+ in 'standards compliant mode'

 

myWidth = document.documentElement.clientWidth;

myHeight = document.documentElement.clientHeight;

}

 

else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {

 

 

//IE 4 compatible

 

myWidth = document.body.clientWidth;

myHeight = document.body.clientHeight;

}

 

if (myWidth != 0) {

 

myWidth = document.documentElement.clientWidth;

myHeight = document.documentElement.clientHeight;

}

 

if (myWidth != 0) {

 

 

var vWidth = myWidth - iWidth;

 

 

var vHeight = myHeight - iHeight;

 

 

if (vWidth < 150)

 

vWidth = 150;

 

if (vHeight < 165)

 

vHeight = 165;

document.getElementById(id).style.width = vWidth +

'px';

 

document.getElementById(id2).style.width = vWidth +

'px';

 

document.getElementById(id3).style.width = vWidth +

'px';

 

document.getElementById(idV).style.width = vWidth +

'px';

 

document.getElementById(Img4).style.width = vWidth +

'px';

 

 

 

}

}

 

 

 

</script>

 

 

</

 

head>

 

<

 

body onload="funSetWidthHeight('div1', 'tb1', 'tb2', 'tb3','Img4', 20, 20);">

 

 

<form id="form1" runat="server">

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script type="text/javascript">

 

<!--

 

function HandleScrolling(e) {

 

 

var grid = $find("<%=RadGrid2.ClientID %>");

 

 

var scrollArea = document.getElementById("<%= RadGrid2.ClientID %>" + "_GridData");

 

 

if (IsScrolledToBottom(scrollArea)) {

 

 

var currentlyDisplayedRecords = grid.get_masterTableView().get_pageSize() * (grid.get_masterTableView().get_currentPageIndex() + 1);

 

 

//if the presently visible items are less than the entire source records count

 

 

//trigger an ajax request to increase them

 

 

if (currentlyDisplayedRecords < 100) {

 

$find(

"<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadMoreRecords");

 

}

}

}

 

//this method calculates whether you have reached the bottom when dragging the vertical grid scroll

 

 

function IsScrolledToBottom(scrollArea) {

 

 

var currentPosition = scrollArea.scrollTop + scrollArea.clientHeight;

 

 

return currentPosition == scrollArea.scrollHeight;

 

}

 

 

-->

 

 

 

</script>

 

</

 

telerik:RadCodeBlock>

 

<

 

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel2" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

</

 

telerik:RadAjaxManager>

 

 

 

 

 

<div id="div1" runat="server" style="width:985px;border:1px ridge blue;">

 

 

 

 

 

 

<table id="tb1" runat="server" style="width: 985px; height: 50px">

 

 

<tr>

 

 

<td align="left" style="width:100%; height: 8%; background-image: url('images/DM-bar.jpg');

 

 

 

background-repeat: repeat-x;vertical-align:top">

 

 

<img id="Img4" runat="server" src="Images/IAC_Logo.jpg" alt="Logo" style="vertical-align: middle" />

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

 

 

 

 

 

 

 

 

 

 

 

<table id="tb2" runat="server" style="width: 985px; height: 1500px;background-color:White">

 

 

<tr>

 

 

<td id="sbCont" style="width: 15%; height: 100%; font-size: 7pt;background-color:White;

 

 

 

color: #000000; vertical-align: top">

 

 

<table style="width: 100%; height: 100%;background-color:White">

 

 

 

<tr valign="top" style="vertical-align: top">

 

 

<td valign="top" style="width: 100%; height:80%">

 

 

 

<div class="demo">

 

 

<div id="accordion">

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">Services</a></h3>

 

 

<div>

 

 

<p>

 

 

<asp:HyperLink ID="lnkDocumentManager" runat="server" Font-Underline="false" Text="File Manager" Target="_blank"/>

 

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">My Reports</a></h3>

 

 

<div>

 

 

<p>

 

Reports

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">Historic Models</a></h3>

 

 

<div>

 

 

<p>

 

Section 33

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">Manaege Data</a></h3>

 

 

<div>

 

 

<p>

 

Section 44

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">View Historic Data</a></h3>

 

 

<div>

 

 

<p>

 

Section 44

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">Analyst capture</a></h3>

 

 

<div>

 

 

<p>

 

Section 44

 

</p>

 

 

</div>

 

 

<h3 style="background-color: #C0C0C0">

 

 

<a href="#">Feedback</a></h3>

 

 

<div>

 

 

<p>

 

Section 44

 

</p>

 

 

</div>

 

 

</div>

 

 

</div>

 

 

</td>

 

 

</tr>

 

 

<tr valign="bottom">

 

 

<td valign="bottom" style="width: 100%; height: 15%">

 

 

<table style="width: 100%; background-color: White">

 

 

<tbody>

 

 

<tr style="vertical-align: bottom">

 

 

 

<td style="width: 100%;">

 

 

<img alt="" src="Images/DM-bar.jpg" width="33%" height="1" />

 

 

<img alt="" id="Img1" width="30" height="8" onclick="leftRoeHide(this);" src="Images/vertical1_arrow.jpg"

 

 

style="cursor: pointer; height: 8px;" />

 

 

<img alt="" src="Images/DM-bar.jpg" width="33%" height="1" />

 

 

</td>

 

 

 

</tr>

 

 

<tr id="leftRoeHide" style="vertical-align: bottom; background-color: white; font-size: 7pt;

 

 

 

color: #000000;" valign="bottom">

 

 

<td style="width: 100%; padding-left: 10px" valign="baseline" >

 

 

<table style="width: 100%; height: 100%; vertical-align: bottom;">

 

 

<tbody>

 

 

<tr>

 

 

<td style="width: 80%">

 

 

<asp:LinkButton ID="lnkUtilities" runat="server" Font-Size="Small" ForeColor="#668fa3" Font-Names="Verdana" Text="Utilities"></asp:LinkButton>

 

 

</td>

 

 

</tr>

 

 

</tbody>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</tbody>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

<td valign="top" style="width: 1%; height: 100%; background-repeat: repeat-y;background-position: center;background-color: #e7ebf0;">

 

 

<img alt="" src="Images/DM-bar.jpg" width="1px" height="100%" />

 

 

 

</td>

 

 

<td id="sbContainer" style="height: 100%; background-color: White">

 

 

<table style="width: 100%; height: 100%; background-color: White">

 

 

<tr valign="top" style="vertical-align: top">

 

 

<td align="right">

 

 

<asp:Label ID="Label1" runat="server" Text="Login as " Font-Names="Calibri" Font-Size="Small"></asp:Label>&nbsp;|&nbsp;

 

 

<asp:LinkButton ID="LinkButton1" runat="server" Font-Names="Calibri" Font-Size="Small" CausesValidation="False"

 

 

ForeColor="#668fa3">Sign Out</asp:LinkButton>

 

 

</td>

 

 

</tr>

 

 

<tr valign="top" style="height: 100%; vertical-align: top">

 

 

<td>

 

 

<table style="width: 100%; background-color: White">

 

 

<tbody>

 

 

<tr style="vertical-align:top">

 

 

<td style="width: 100%;height:100%" valign="top">

 

 

<table style="width: 100%; background-color: White">

 

 

<tbody>

 

 

<tr style="height:100%">

 

 

<td style="width: 70%;" valign="top" >

 

 

<Tittle:PanelCurveControl ID='tblCrvPnl' runat="server" Expandable="true" Margin="10" Title="Approve Historical Details" TabBackColor="#668fa3" HasPrint="false">

 

 

<telerik:RadGrid ID="RadGrid2" AllowSorting="True" runat="server" AllowPaging="true"

 

 

Width="40%" PageSize="15" GridLines="Both" Skin="MyCustomSkin" EnableEmbeddedSkins="false" >

 

 

<PagerStyle Visible="false" />

 

 

<MasterTableView TableLayout="Fixed"/>

 

 

<ClientSettings>

 

 

<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />

 

 

<ClientEvents OnScroll="HandleScrolling" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">

 

 

</telerik:RadAjaxLoadingPanel>

 

 

</Tittle:PanelCurveControl>

 

 

</td>

 

 

</tr>

 

 

<tr style="height:100%">

 

 

<td style="width: 70%;" valign="top">

 

 

 

</td>

 

 

</tr>

 

 

 

<tr style="height:100%">

 

 

<td style="width: 70%">

 

 

 

 

</td>

 

 

</tr>

 

 

</tbody>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</tbody>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

<tr valign="bottom" style="height: 100%; vertical-align: bottom">

 

 

<td valign="bottom">

 

 

<table style="width: 100%; height: 100%; vertical-align: bottom">

 

 

<tr style="vertical-align: bottom">

 

 

<td style="width: 100%; background-repeat: repeat-x; background-position: center;

 

 

 

background-color: #e7ebf0;" align="center">

 

 

<img alt="" id="Img2" width="60" height="10" onclick="MiddleRowHide(this);" src="Images/vertical1_arrow.jpg"

 

 

style="cursor: pointer" />

 

 

</td>

 

 

</tr>

 

 

<tr style="height: 20px; vertical-align: bottom">

 

 

<td style="width: 100%; background-image: url(Images/DM-bar.jpg); background-repeat: repeat-x;

 

 

 

background-position: center; background-color: #e7ebf0;" align="center">

 

 

</td>

 

 

</tr>

 

 

<tr id="MiddleRowHide" style="background-color: white; font-size: 7pt; color: #000000;

 

 

 

vertical-align: bottom; height: 100%" valign="bottom">

 

 

<td style="width: 100%">

 

 

<br />

 

 

<br />

 

 

<br />

 

 

<br />

 

 

<br />

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

<table id="tb3" runat="server" style="width: 985px; height: 50px">

 

 

<tr>

 

 

<td style="background-image: url('Images/extra bar1.jpg'); background-repeat: repeat;

 

 

 

clip: rect(auto, 25px, auto, auto); height: 15px;">

 

 

<table style="width: 100%">

 

 

<tr>

 

 

<td style="width: 20%; font-family: Calibri; font-size: 15px; padding: 5px" align="right">

 

 

<asp:LinkButton ID="lnkDesclaimer" runat="server" ForeColor="White">Desclaimer</asp:LinkButton>&nbsp;&nbsp;

 

 

<span style="color: white">|</span>

 

 

</td>

 

 

<td style="width: 20%; font-family: Calibri; font-size: 15px; padding: 5px" align="left">

 

 

&nbsp;

 

 

<asp:Label runat="server" ID="lbl1" Text="(Reserved)" ForeColor="White"></asp:Label>

 

 

</td>

 

 

<td style="width: 25%">

 

 

</td>

 

 

<td style="width: 25%; font-family: Calibri; font-size: 15px; padding: 5px;" align="right">

 

 

<img alt="" src="Images/phone.png" width="10" height="10" />&nbsp;<asp:Label ID="lblContactUs"

 

 

runat="server" ForeColor="White">Contact Us &nbsp;&nbsp;|</asp:Label>

 

 

</td>

 

 

<td style="font-family: Calibri; font-size: 15px; padding: 5px; width: 25%" align="left"

 

 

class="style1">

 

 

<img alt="" src="Images/print.gif" width="10" height="10" />&nbsp;<asp:Label runat="server"

 

 

ID="lblPrint" ForeColor="White" Text="Print"></asp:Label>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</div>

 

 

</form>

 

</

 

body>

 

</

 

html>

 

 

Thanks for any help.
Satyajit Kadam

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 07 Mar 2012, 08:53 PM
Hello,

I recommend that you examine the project attached in the code library below and see if it works for you:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/setting-100-height-and-resize-on-container-resize-for-grid-with-scrolling-and-static-headers.aspx

Regards,
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
Satyajit
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or