Error: 'null' is null or not an object
The error is occurring when it's trying to call the changepagesize function.
The grid and splitter on in a content page. Any help would be appreciated.
ASPX
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManagerProxy1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="ARGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="rcbCodeList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rcbListType" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
<telerik:AjaxUpdatedControl ControlID="rtbCode" /> |
<telerik:AjaxUpdatedControl ControlID="btnAddCode" /> |
<telerik:AjaxUpdatedControl ControlID="rlbCodes" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="rcbListType"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rtbCode" /> |
<telerik:AjaxUpdatedControl ControlID="btnAddCode" /> |
<telerik:AjaxUpdatedControl ControlID="rlbCodes" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnAddCode"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rtbCode" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
<telerik:AjaxUpdatedControl ControlID="rlbCodes" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="ARGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="ARGrid1" |
LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
</telerik:RadCodeBlock> |
<script type="text/javascript"> |
function ClientResized(sender, eventArgs) { |
alert('in resize'); |
var test = $find("<%= RadAjaxManagerProxy1.ClientID %>"); |
alert('found proxy'); |
$find("<%= RadAjaxManagerProxy1.ClientID %>").ajaxRequest('ChangePageSize'); |
alert('changed size'); |
// if ($find("<%= RadAjaxManagerProxy1.ClientID %>").visible) |
// { |
//$find("<%= RadAjaxManagerProxy1.ClientID %>").ajaxRequest('ChangePageSize'); |
//} |
} |
</script>
<telerik:RadPane ID="gridPane" runat="server" Height="400px" Scrolling="None" OnClientResized="ClientResized">
<table border="0" width="986px" cellpadding="0" cellspacing="0" style="background-color:White;table-layout:fixed">
<tr valign="top">
<td width="15px"><img src="images/spacer.gif" width="15px" alt="" /></td>
<td style="height:400px;">
<table border="0" cellpadding="0" cellspacing="0" width="986px" style="background-color:White;table-layout:fixed" >
<tr>
<td>
<telerik:RadGrid ID="ARGrid1" runat="server" Width="95%" GridLines="None"
PageSize="50" AllowSorting="True" AllowPaging="True" Visible="false"
OnNeedDataSource="ARGrid1_NeedDataSource" ShowStatusBar="true" ShowGroupPanel="true" Skin="Outlook" >
<MasterTableView AllowFilteringByColumn="true" AllowMultiColumnSorting="true" Width="100%" CommandItemDisplay="None" AutoGenerateColumns="true">
<Columns>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" ColumnsReorderMethod="Reorder" >
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" FrozenColumnsCount="1" ScrollHeight="100%" />
<Resizing ClipCellContentOnResize="false" AllowColumnResize="true" />
</ClientSettings>
<GroupingSettings ShowUnGroupButton="true" />
</telerik:RadGrid>
</td>
</tr>
</table>
</td>
</tr>
</table>
</telerik:RadPane>
|
Server code:
protected void RadAjaxManagerProxy1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
switch (e.Argument.ToString()) |
{ |
case "ChangePageSize": |
//Calculate the number of rows that fit in the RadPane. |
//In this case 23 is the sum of the height of a single row and its upper border width. |
//Depending on the paticular scenario this value may vary. |
int rows = (Int32.Parse(this.gridPane.Height.Value.ToString()) - 60) / 23; |
if (rows >= 1) |
{ |
ARGrid1.PageSize = rows; |
// Check whether the CurrentPageIndex is correct. |
if (Session["itemsCount"] != null) |
{ |
int itemsCount = (int)Session["itemsCount"]; |
int pageCount = (int)Math.Ceiling(((double)itemsCount / rows)); |
if (ARGrid1.MasterTableView.CurrentPageIndex > pageCount - 1) |
{ |
ARGrid1.MasterTableView.CurrentPageIndex = pageCount - 1; |
} |
} |
ARGrid1.Rebind(); |
} |
break; |
} |
} |
public string RadGrid1PanelClientID; |
protected void RadAjaxManagerProxy1_AjaxSettingCreated(object sender, AjaxSettingCreatedEventArgs e) |
{ |
if (e.Initiator.ID == "ARGrid1") |
{ |
this.RadGrid1PanelClientID = e.UpdatePanel.ClientID; |
} |
} |