XmlHttpPanel call back error when using grid with radtabstrip.

2 posts, 0 answers
  1. Tirumalesh
    Tirumalesh avatar
    23 posts
    Member since:
    Aug 2011

    Posted 05 Sep 2011 Link to this post

    HI all,
    I have a grid in default.aspx,when i click a grid row the xmlhttppanel displays the selected row information in a tabstrip.in every tab i have a grid for some operations.When i click main grid row i'm getting error like:
    XmlHttpPanel callback error:Exception:script control'PageSizeComboBox'is not a registered script control.Script Control must be registered using RegisteredScriptControl() before calling RegisteredScriptDescriptors().Parameter name:scriptControl.
    Default.aspx:

    <%@ Page Title="Tracker" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
        Inherits="_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 id="Head1" runat="server">
        <title>Tracker</title>
        <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
            <style type="text/css">
                .divContainer
                {
                    background: url('Image.JPG')no-repeat;
                    width: 100%;
                    position: relative;
                    height: 768px;
                }
                .body
                {
                }
                .divGrid, .divXmlHttpPanel
                {
                    position: absolute;
                    top: 8px;
                }
                .divXmlHttpPanel
                {
                    left: 490px;
                }
                .rgInfoPart
                {
                    display: none !important;
                }
                .title
                {
                    font-size: 12px;
                    color: #606060;
                }
                .info
                {
                    color: black;
                    font-size: 12px;
                }
                
                .button
                {
                    border: 1px solid;
     border-color: #4E667E #5E7488 #425C71;
    padding-top: 1px;
    padding-bottom: 1px;
    background: #D6E1E7 repeat-x 0 0 url(commonButton.gif);
    color: #0D202B;
    font: 12px "segoe ui",tahoma,sans-serif;
    }
                
            </style>
        </telerik:RadCodeBlock>
    </head>
    <body style="background: #f2f2f2;" class="body">
        <form id="mainForm" method="post" runat="server" style="margin-top: -8px;">
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">

                function ShowInsertForm() {
                    window.radopen("Projects.aspx", "UserListDialog");
                    return false;
                }

              
            

                function ShowResourceInsertForm() {
                    window.radopen("EditResource.aspx", "UserListDialog");
                    return false;
                }

                function ShowResourceEditForm(id, rowIndex) {
                    var grid = $find("<%= grdResource.ClientID %>");
                    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                    grid.get_masterTableView().selectItem(rowControl, true);

                    window.radopen("EditResource.aspx?ResourceID=" + id, "UserListDialog");
                    return false;
                }

         
                function refreshGrid(arg) {
                    if (!arg) {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                    }
                    else {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                    }
                }

                function rowSelected(sender, args) {
                    var key = args.getDataKeyValue("ProjectId");
                    var panel = $find("<%=RadXmlHttpPanel1.ClientID %>");
                    panel.set_value(key);
                }

            
                function grdResourceRowDblClick(sender, eventArgs) {
                    window.radopen("EditResource.aspx?ResourceID=" + eventArgs.getDataKeyValue("ProjectResourceId"), "UserListDialog");
                }

              
                function gridCommand(sender, args) {
                    if (args.get_commandName() == "DownloadAttachment") {
                        var manager = $find('<%= RadAjaxManager1.ClientID %>');
                        manager.set_enableAJAX(false);

                        setTimeout(function () {
                            manager.set_enableAJAX(true);
                        }, 0);
                    }
                }
                function conditionalPostback(sender, eventArgs) {
                    var eventArgument = eventArgs.get_eventArgument();

                    if (eventArgument.indexOf("Update") > -1 || eventArgument.indexOf("PerformInsert") > -1) {
                        if (upload && upload.getFileInputs()[0].value != "") {
                            eventArgs.set_enableAjax(false);
                        }
                    }
                }

                var upload = null;

                function uploadFileSelected(sender, args) {
                    upload = sender;
                    var uploadContainer = sender.get_element();
                    var editTable = uploadContainer.parentNode.parentNode.parentNode.parentNode;
                    var fileNameTextBox = editTable.rows[0].cells[1].getElementsByTagName('input')[0];

                    fileNameTextBox.value = args.get_fileInputField().title;
                }


            </script>
           
            
        </telerik:RadCodeBlock>
        <telerik:RadAjaxManager  ID="RadAjaxManager1" runat="server"  EnableAJAX="true" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <ClientEvents OnRequestStart="conditionalPostback" />
           <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="grdFiles">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="grdFiles" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 
           
            </AjaxSettings>
        </telerik:RadAjaxManager>
        

        
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
        <table width="130%">
            
            
            <tr>
                <td class="divContainer">
                    <table>
                        <tr>
                            <td class="divGrid">
                                <telerik:RadGrid ID="RadGrid1" ShowFooter="true" AllowPaging="True" EnableLinqExpressions="False" RegisterWithScriptManager="false"
                                    Skin="Default" AllowSorting="True" AutoGenerateColumns="False" Width="470px"
                                    OnItemCreated="RadGrid1_ItemCreated" OnNeedDataSource="RadGrid1_NeedDataSource"
                                    PageSize="100" ShowStatusBar="True" GridLines="None" runat="server" CellSpacing="0"
                                    OnDeleteCommand="RadGrid1_DeleteCommand" OnItemDataBound="RadGrid1_ItemDataBound">
                                    <ClientSettings Selecting-AllowRowSelect="true" ClientEvents-OnRowSelected="rowSelected"
                                        EnableRowHoverStyle="true">
                                        <Selecting AllowRowSelect="true" />
                                        <ClientEvents OnRowSelected="rowSelected"></ClientEvents>
                                    </ClientSettings>
                                    <MasterTableView Width="100%" CommandItemDisplay="Top" ClientDataKeyNames="ProjectId"
                                        DataKeyNames="ProjectId">
                                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                        </RowIndicatorColumn>
                                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                        </ExpandCollapseColumn>
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="ProjectId" HeaderText="ProjectId" ReadOnly="True"
                                                SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" SortExpression="Title">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle Width="50%" />
                                                <FooterTemplate>
                                                    <asp:LinkButton Style="color: Blue;" ID="lnkAddproject" OnClientClick="return ShowInsertForm();"
                                                        runat="server">
                                                        <b>Add New Projects</b>
                                                    </asp:LinkButton>
                                                </FooterTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status" SortExpression="Status">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("Status")%>' />
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn HeaderText="Due Date" UniqueName="DueDate" DataField="DueDate">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblDueDate" runat="server" Text='<%#GetOnlyDate(Eval("DueDate"))%>' />
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridButtonColumn Text="Delete" UniqueName="DeleteColumn" CommandName="Delete"
                                                ButtonType="ImageButton">
                                                <HeaderStyle Width="2%" />
                                            </telerik:GridButtonColumn>
                                        </Columns>
                                        <CommandItemTemplate>
                                            <span style="padding-left: 15px; text-decoration: none;"><b>
                                                <h2>
                                                    Projects</h2>
                                            </b></span>
                                        </CommandItemTemplate>
                                        <EditFormSettings>
                                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                            </EditColumn>
                                        </EditFormSettings>
                                        <PagerStyle Mode="Slider" PageButtonCount="5" AlwaysVisible="True" />
                                    </MasterTableView>
                                    <FilterMenu EnableImageSprites="False" AppendDataBoundItems="True">
                                    </FilterMenu>
                                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Hay">
                                    </HeaderContextMenu>
                                </telerik:RadGrid>
                            </td>
                        </tr>
                        <tr>
                            <td class="divXmlHttpPanel">
                                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                                    <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" EnableClientScriptEvaluation="true"
                                        runat="server" OnServiceRequest="XmlHttpPanel_ServiceRequest" RenderMode="Block"
                                        Width="750px">
                                        <table id="tblControl" runat="server" style="width: 750px;">
                                            <tr>
                                                <td colspan="2">
                                                   
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="60%" valign="top">
                                                   <asp:Button ID="btnEmail" runat="server" Visible="false" Text="Email Task"
                                                        onclick="btnEmail_Click" />
                                                   <br />
                                                    <telerik:RadTabStrip ID="RadTabStrip1" RegisterWithScriptManager="false" runat="server" MultiPageID="RadMultiPage1" Orientation="HorizontalTop" OnTabClick="RadTabScript1_TabClick"> <%--   OnClientTabSelecting="onTabSelecting"> --%>
                                                        <Tabs>
                                                            <telerik:RadTab Text="Resources" runat="server" TabIndex="0"  PageViewID="radPageResources"></telerik:RadTab>
                                                            <telerik:RadTab Text="Tasks" runat="server" TabIndex="1" PageViewID="radPageTasks"></telerik:RadTab>
                                                            <telerik:RadTab Text="Messages" runat="server" TabIndex="2" PageViewID="radPageMessages"></telerik:RadTab>
                                                            <telerik:RadTab Text="Files" runat="server" TabIndex="3" PageViewID="radPageFiles"></telerik:RadTab>
                                                            <telerik:RadTab Text="Feedback" runat="server" TabIndex="4" PageViewID="radPageFeedback"></telerik:RadTab>
                                                        </Tabs>
                                                    </telerik:RadTabStrip>
                                                   
                                                   
                                                    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" RegisterWithScriptManager="false" >    <%-- OnPageViewCreated="RadMultiPage1_PageViewCreated" >   RenderSelectedPageOnly="true"  >  --%>
                                                            <telerik:RadPageView ID="radPageResources" runat="server" TabIndex="0">
                                                                 <telerik:RadGrid runat="server" ID="grdResource" PageSize="5" Skin="Default" AllowPaging="True"
                                                        AllowSorting="true" ShowFooter="true" AutoGenerateColumns="False" Width="97%"
                                                        OnItemCreated="grdResource_ItemCreated" OnNeedDataSource="grdResource_NeedDataSource"
                                                        OnDeleteCommand="grdResource_DeleteCommand" ShowStatusBar="True" GridLines="None"
                                                        OnItemDataBound="grdResource_ItemDataBound">
                                                        <PagerStyle Mode="NumericPages" AlwaysVisible="true" />
                                                        <MasterTableView Width="100%" CommandItemDisplay="Top" ClientDataKeyNames="ProjectResourceId"
                                                            DataKeyNames="ProjectResourceId">
                                                            <Columns>
                                                                <telerik:GridTemplateColumn Visible="false">
                                                                    <ItemTemplate>
                                                                        <asp:Label runat="server" ID="lblResourceID" Text='<%# Eval("ProjectResourceId") %>' />
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="30%" />
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn>
                                                                    <ItemTemplate>
                                                                        <asp:Label runat="server" ID="lblUsername" Text='<%# Eval("UserName") %>' />
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="30%" />
                                                                    <FooterTemplate>
                                                                        <span style="text-decoration: none;">
                                                                            <asp:LinkButton Style="color: Blue;" ID="lnkAddResource" OnClientClick="return  ShowResourceInsertForm();"
                                                                                runat="server"><b> Add New Resource</b></asp:LinkButton>
                                                                    </FooterTemplate>
                                                                    <FooterStyle Width="40%" />
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn UniqueName="TemplateEditColumn">
                                                                    <ItemTemplate>
                                                                        <asp:ImageButton ID="EditResourceLink" runat="server" ImageUrl="~/Images/edit.gif" />
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="2%" />
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridButtonColumn Text="Delete" UniqueName="DeleteColumn" CommandName="Delete"
                                                                    ButtonType="ImageButton">
                                                                    <HeaderStyle Width="2%" />
                                                                </telerik:GridButtonColumn>
                                                            </Columns>
                                                            <CommandItemTemplate>
                                                                <b>
                                                                    <h3>
                                                                        Resources</h3>
                                                                </b></span>
                                                            </CommandItemTemplate>
                                                            <PagerStyle AlwaysVisible="True" />
                                                        </MasterTableView>
                                                        <ClientSettings>
                                                            <Selecting AllowRowSelect="true" />
                                                           
                                                        </ClientSettings>
                                                    </telerik:RadGrid>
                                                            </telerik:RadPageView>
                                                            

                                                 
                                        </table>
                                    </telerik:RadXmlHttpPanel>
                                </telerik:RadAjaxPanel>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="UserListDialog" runat="server" Title="Project" Width="650"
                    Height="650" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" />
            </Windows>
        </telerik:RadWindowManager>
        </form>
    </body>
    </html>


    Help me out.
    Regards,
    Tirumalesh.
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 07 Sep 2011 Link to this post

    Hello Tirumalesh,

    RadGrid is not fully compatible with the RadXmlHttpPanel, because some of its functionality relies heavily on ViewState, and the XmlHttpPanel does not load and save the ViewState of its child controls. More precisely the problem is caused by the Paging mode of the RadGrid. Please set it to NumericPages ( <PagerStyle Mode="NumericPages" />)and the problem should disappear.

    All the best,
    Pero
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top