RadWindow Attributes Ignored

4 posts, 0 answers
  1. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 07 Dec 2011 Link to this post

    My Set up consist of a Grid and a ClientClick on the Row to open a RadWindow using the ClientSide  radopen. The problem I am encountering is that none of the RadWindow attributes are working... as if whatever i've defined in the RadWindow Attributes are ignored.
    Below is the code snippet from my user control where the RadGrid is located and it's associated code.

    <telerik:RadWindowManager ID="wndManager" runat="server" EnableShadow="False">
        <Windows>
            <telerik:RadWindow ID="wndShoppingListItem" runat="server" Title="Shopping List Item"
                ReloadOnShow="true" ShowContentDuringLoad="false" KeepInScreenBounds="True" Modal="True"
                VisibleStatusbar="False" Height="525" Width="725px" VisibleTitlebar="True" Behavior="Close, Move"
                Behaviors="Close, Move" Skin="gmBlue" EnableEmbeddedSkins="false" />
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ShowEditForm(accountId, listId, itemId, productId, rowIndex) {
                //alert('ShowEditForm');
                var grid = $find("<%= grdSelectedList.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
     
                var wnd = window.radopen("wndShoppingListItem.aspx?accountId=" + accountId +
                                                        "&listId=" + listId +
                                                        "&itemId=" + itemId +
                                                        "&productId=" + productId
                                                        , "<%= wndShoppingListItem.ClientID %>");
                return false;
            }
            function ShowInsertForm() {
                //alert('ShowInsertForm');
                var wnd = window.radopen("wndShoppingListItem.aspx", "<%= wndShoppingListItem.ClientID %>");
                return false;
            }
            function refreshGrid(arg) {
                //alert('refresgGrid' + arg);
                var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
                if (!arg) {
                    ajaxManager.ajaxRequest("Rebind");
                }
                else {
                    ajaxManager.ajaxRequest("RebindAndNavigate");
                }
            }
            function RowClick(sender, eventArgs) {
                //alert('RowClick' + eventArgs);
                var wnd = window.radopen("wndShoppingListItem.aspx?accountId=" + eventArgs.getDataKeyValue("Account_ID") +
                                                        "&listId=" + eventArgs.getDataKeyValue("List_ID") +
                                                        "&itemId=" + eventArgs.getDataKeyValue("Item_ID") +
                                                        "&productId=" + eventArgs.getDataKeyValue("Product_ID")
                                                        , "<%= wndShoppingListItem.ClientID %>");
            }
        </script>
    </telerik:RadCodeBlock>


    Below is the actual content of the RadWindow

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wndShoppingListItem.aspx.cs"
        Inherits="GrocerMania.AppServer0001.Pages.wndShoppingListItem" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title>Shopping List Item</title>
        <link href="../Lib/shoppinglist.css" rel="stylesheet" type="text/css" />
        <link href="../Lib/wndMain.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <script type="text/javascript">
            function CloseAndRebind(args) {
                //alert('CloseAndRebind' + args);
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
            }
     
            function GetRadWindow() {
                //alert('GetRadWindow');
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
     
                return oWindow;
            }
     
            function CancelEdit() {
                //alert('CancelEdit');
                GetRadWindow().close();
            }
        </script>
        <asp:ScriptManager ID="ScriptManager2" runat="server" />
        <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
        </telerik:RadStyleSheetManager>
        <div class="sliHeader">
            <div class="sliItemImage">
                <asp:Image ID="imgItem" runat="server" ImageUrl="~/AppServer0001/Data_Images/default.gif"
                    Height="80" Width="80" BorderColor="black" BorderWidth="1"/>
            </div>
            <div class="sliItemDescription">
                <asp:Label ID="lblItemName" runat="server" CssClass="lblItemName">Milk, Lowfat 1%</asp:Label>
                <div class="smallLabel">
                    Last purchased:</div>
                <asp:Label ID="lblLastPurchased" runat="server" CssClass="smallFont"> October 1, 2011 (2 gallons)</asp:Label><br />
                <div class="smallLabel">
                    How much I have:</div>
                <asp:Label ID="lblHowMuch" runat="server" CssClass="smallFont">None!</asp:Label>
            </div>
        </div>
        <div class="sliBody">
            <div class="sliColName">
                Quantity:</div>
            <div class="sliColControl">
                <div class="divQtyWrapper">
                    <div class="divPlusMinus" id="qtyMinus">
                        <img alt="minus" src="../Images/btMinusGray.gif" /></div>
                    <div class="divQty">
                        <asp:TextBox ID="txtQty" runat="server" value="1" CssClass="txtQtyInput"></asp:TextBox></div>
                    <div class="divPlusMinus" id="qtyPlus">
                        <img alt="plus" src="../Images/btPlusGray.gif" /></div>
                </div>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Item type:</div>
            <div class="sliColControl">
                <telerik:RadComboBox ID="cmbType" runat="server" Width="345px">
                </telerik:RadComboBox>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Item size:</div>
            <div class="sliColControl">
                <telerik:RadComboBox ID="cmbSize" runat="server" Width="345px">
                </telerik:RadComboBox>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Brand:</div>
            <telerik:RadComboBox ID="cmbBrand" runat="server" Width="345px">
            </telerik:RadComboBox> <asp:HyperLink ID="lnkBrandPref" runat="server" Text="Brand preferences" NavigateUrl="#"></asp:HyperLink>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Allow substitute items?</div>
            <div class="sliColControl">
                <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="345px">
                </telerik:RadComboBox>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Allow bulk discounts?</div>
            <div class="sliColControl">
                <telerik:RadComboBox ID="RadComboBox2" runat="server" Width="345px">
                </telerik:RadComboBox>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="sliColName">
                Price alert?</div>
            <div class="sliColControl">
                <div class="divRadioButtons">
                    <telerik:RadButton ID="btnPriceAlert" runat="server" ButtonType="ToggleButton" ToggleType="Radio"
                        Text="No" GroupName="grpPriceAlert">
                    </telerik:RadButton>
                    <br />
                    <telerik:RadButton ID="RadButton1" runat="server" ButtonType="ToggleButton" ToggleType="Radio"
                        Text="Automatic - When GrocerMania finds a bargain price" GroupName="grpPriceAlert">
                    </telerik:RadButton>
                    <br />
                    <telerik:RadButton ID="RadButton2" runat="server" ButtonType="ToggleButton" ToggleType="Radio"
                        Text="Manual - When the price is at or below $" GroupName="grpPriceAlert">
                    </telerik:RadButton>
                    <telerik:RadTextBox ID="priceLimit" runat="server" Width="50">
                    </telerik:RadTextBox><br />
                </div>
            </div>
            <div class="sliSeparator">
            </div>
            <div class="centeredContent">
                <telerik:RadButton ID="btnSubmit" runat="server" OnClientClicking="OnClientClicking"
                    Width="111" Height="31">
                    <Image ImageUrl="../Images/btSubmitDarkBlue.gif" />
                </telerik:RadButton>
                  
                <telerik:RadButton ID="btnAddToWishList" runat="server" OnClientClicking="OnClientClicking"
                    Width="130" Height="31">
                    <Image ImageUrl="../Images/btAddToWishListCharcoal.gif" />
                </telerik:RadButton>
                  
                <telerik:RadButton ID="btnCancel" runat="server" OnClientClicking="CancelEdit" Width="72"
                    Height="31">
                    <Image ImageUrl="../Images/btCancelCharcoal.gif" />
                </telerik:RadButton>
            </div>
        </div>
        </form>
    </body>
    </html>


    What am I doing wrong? The Window when it opens, is smaller in size ( about 250px bx 250px) and then readjust based on the content...I need to have it open the correct fixed size as defined in the RadWindow. Also the CSS skin is also ignored...although i have the csslink in the parent page!

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 08 Dec 2011 Link to this post

    Hi Gotcha,

    Please examine the following help article that explains such behavior and offers several options to resolve it: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-wrong-window-opened.html.


    Kind regards,
    Marin
    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
  3. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 04 Jan 2012 Link to this post

    Ok it worked after i removed the RWManager from the Master since this was the last one I added... but now i see the need to have the RWM from the Master template... so i thought, ok, it should be ok just to move the RWM to the master and remove the original one from my Page but leaving the RadWindows declaration in the page... Doing so , i got the same behaviour as when i had 2 RWMs... where the attributes settings  are ignored.

    What am I doing wrong? Is it because the Page where the Windows are defined and the Javascript with radopen() are called cannot see the RWM which is now moved to the Master ?

    I'm going to epxeriment some more moving them around...
     ps: all my RadWindows are opened via Client Side Javascript... not sure if it makes any difference.

    Thanks
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 06 Jan 2012 Link to this post

    Hi,

    Please examine the above article carefully. The essential part in your issue is that radopen() is a global function attached to the first manager on the rendered page, it cannot be used for opening a separate RadWindow you have defined somewhere in the markup outside of the Windows collection of this RadWindowManager. More information on the ways to open a RadWindow is available in the following help aricle: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.

    What happens in  your case is that you again reference the wrong manager instead of the windows you actually want to open. If you have them on the page you need to use $find() to get a reference to them and call their show() method. Calling radopen() will use the manager from the master page which seems like ignoring the properties you set. An alternative is to still use radopen and the RadWindow's client-side API to modify their size, behaviors, modality, etc. (after you open them) as needed instead of declaring multiple RadWindows.


    All the best,
    Marin
    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
Back to Top