Problem with set_virtualItemCount for radGrid in radWindow with radWindowManager

5 posts, 0 answers
  1. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 13 Jun 2011 Link to this post

    I have a rather complex scenario.

    I'm creating a set of coordinating User Controls that give me a tabbed interface where the tabs are Help, Search, Search Results, List, Edit, New, View, and some customizable functions.  I'm turning these into a fully ajaxified interface controlled by instantiated JavaScript objects in an external JS file so that I can have multiple interfaces on the same page that use this interface.  I have to say that this would be much, much more difficult without you guys at Telerik.

    When I did this, I was able to instantiate a single interface on a page and it all worked perfectly.  Very snappy response since it's all Ajaxified.  So, for the next step, I took this interface and placed it in a RadWindow within a RadWindowManager so that I could utilize it in a desktop-like MDI interface like you have in the demos section.  When I did this, things started to go funky.  To start, I was getting postbacks on things like tab clicks, grid sorting and paging, and stuff like that.  I also noticed that the counts in the RadGrid pager were messed up.

    To address this, I'm taking a step at a time in order to focus on a single problem with minimal complexity. 

    I've been able to recreate a situation where I have a radGrid within a radWindow within a radWindowManager, and I'm ONLY calling set_virtualItemCount(5) in order to test updating the pager on the RadGrid.  When I load this page, it shows 21 items in 2 pages.  When I click the button to trigger the JavaScript, it remains at 21 items in 2 pages.

    IF I REMOVE the RadWindowManager, and just have a standalone RadWindow, clicking the button changes the page count information to 5 items in 1 page.  And, of course, if I take out the RadWindow as well, clicking the button changes the page count to 5 items in 1 page.

    Can you figure out what's going on here?

    Here's my code.  It's all self-contained (no external JS file):

    <!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" lang="en-us" >
    <head id="Head1" runat="server">
        <meta http-equiv="Content-Language" content="en-us" />
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta http-equiv="Content-Script-Type" content="text/javascript" />
        <meta name="description" id="PageDescription" runat="server" content="" />
        <meta name="keywords" id="PageKeywords" runat="server" content="" />
        <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server" enableviewstate="true" method="post">
     
    <telerik:RadScriptManager runat="server" ID="SM1">
        <Services>
            <asp:ServiceReference Path="~/TestServices.asmx" />
        </Services>
    </telerik:RadScriptManager>
     
                <telerik:RadWindowManager ShowOnTopWhenMaximized="false" Skin="Web20" Width="590"
                        Height="360" Behaviors="Close,Maximize,Minimize,Move,Reload,Resize"
                        ID="RadWindowManager"
                        runat="server" EnableShadow="true">
                    <Windows>
                        <telerik:RadWindow ID="VendorAdminWindow" runat="server" VisibleOnPageLoad="true" ShowContentDuringLoad="true" DestroyOnClose="false" Skin="Web20" Width="590" >
                            <ContentTemplate>
                                <asp:Button ID="Button1" Text="Load" runat="server" OnClientClick="return loadData()" />
                                <Telerik:radGrid
                                    ID="ItemList"
                                    runat="server"
                                    AllowPaging="True"
                                    PageSize="20"
                                    PagerStyle-AlwaysVisible="true"
                                    AllowSorting="True"
                                    HorizontalAlign="NotSet"
                                    AutoGenerateColumns="False"
                                    Skin="WebBlue"
                                    MasterTableView-Caption="Right-Click a row to access the Context-Sensitive Menu, Click Column Names to Sort"
                                    Width="98%"
                                >
                                <MasterTableView
                                    ClientDataKeyNames="ItemID_rin" AllowMultiColumnSorting="false"
                                >
                                    <Columns>
                                        <Telerik:GridBoundColumn
                                            DataField="ItemID_rin"
                                            UniqueName="ItemID_rin"
                                            visible="false"
                                            HeaderText="Item ID"
                                        />
                                        <Telerik:GridBoundColumn
                                            DataField="FirstName_rst"
                                            UniqueName="FirstName_rst"
                                            HeaderText="First Name"
                                            ItemStyle-VerticalAlign="Top"
                                        />
                                        <Telerik:GridBoundColumn
                                            DataField="LastName_rst"
                                            UniqueName="LastName_rst"
                                            HeaderText="Last Name"
                                            ItemStyle-VerticalAlign="Top"
                                        />
                                        <Telerik:GridBoundColumn
                                            DataField="ForumHandle_rst"
                                            UniqueName="ForumHandle_rst"
                                            HeaderText="Handle"
                                            ItemStyle-VerticalAlign="Top"
                                        />
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="true" />
                                    <ClientEvents OnCommand="function(){}" />
                                </ClientSettings>
                                <PagerStyle
                                    Mode="NextPrevAndNumeric"
                                    Position="TopAndBottom"
                                />
                                </Telerik:radGrid>
     
                            </ContentTemplate>
                        </telerik:RadWindow>
                    </Windows>
                </telerik:RadWindowManager>
     
                <script language="javascript" type="text/javascript">
     
                    loadData = function () {
                        /********************************************************************************************\
                        |*                                                                                                                                                                                  *|
                        |*  loadData                                                                                                                                                                *|
                        |*                                                                                                                                                                                  *|
                        \********************************************************************************************/
     
                        Grid_aob = $find('<%= ItemList.ClientID %>');
                        var tableView = Grid_aob.get_masterTableView();
                        tableView.clearSelectedItems();
                        tableView.set_virtualItemCount(5);
                        alert('Counts should be updated to 5 items.');
                        return false;
     
                    }
     
                </script>
     
    </form>
    </body>
    </html>

    I'm hoping, of course, that this uncovers the root of all of my problems with this solution.  I have to say that I don't have a 100% grasp on all of the details with the postbacks, but I clearly was able to reproduce this problem. 

    I've tested this in Firefox 4.01, IE 9 (using modes for IE 8 and IE 9), Chrome 12.0.742.91, and safari 5.0.5.

    Thanks for your assistance.
  2. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 16 Jun 2011 Link to this post

    Hi LeBear,

    I was able to reproduce the problem with the provided markup. This seems to be a limitation caused by the fact that the RadWindowManager modifies the client ids of the Grid elements and thus prevents it from working as expected. I can suggest you to use the RadWindow on its own, outside the RadWindowManager, which should not have any drawbacks in this case.

    I hope this helps.

    Kind regards,
    Pavel
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 16 Jun 2011 Link to this post

    Hi Pavel:

    Thanks for looking into this.  I suspected this was the problem, but I admit I was looking for a way around it.  I've already partially re-written the cascade feature to work without a RadWindowManager, and I guess I'll have to do the same with the tile feature.  However, I'd rather rely on you guys.  :)

    Is there a chance that this could eventually be addressed?

    Thanks.
  5. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 17 Jun 2011 Link to this post

    Hi LeBear,

    I am afraid that we will not be able to address this issue in the code of our controls. The Grid's logic for getting the id cannot be modified easily without affecting some other scenarios. As for the RadWindowManager, the limitation is caused by its inherent structure and the way it adds windows and controls in its controls collection and is also not possible to alter it.

    Please excuse us for the caused inconvenience.

    Best wishes,
    Pavel
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 17 Jun 2011 Link to this post

    :(

    Understood, and thanks for the information.

    It's possible it affected other controls, too, which makes sense.  I just gotta work on the cascade and tile functions, which I can live with.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017