Clicking on custom button with RadWindow maximizes the window

6 posts, 0 answers
  1. Duy
    Duy avatar
    18 posts
    Member since:
    Nov 2008

    Posted 16 Sep 2010 Link to this post

    I am having an issue with a custom "help" button that I added to the Radwindow.  When I click on my custom button, the window maximizes. And when I click on the custom button again, nothing happens. I am NOT expecting the window size to change. Does anyone know what is going on?

    Telerik.Web.UI V: 2009.2.701.20
    Using IE8 in Browser mode: IE8 Document mode: IE 8 Standards

    Is there some embedded event that I need to cancel?

    function showRadWindow() {
        window.radopen("SamplePage.aspx", "sampleWindow");
        return false;
    }
     
    function AddHelpIcon(radWindow) {
     
        var radWindowDom = document.getElementById(radWindow.get_id());
        var TitleBar = radWindow.GetTitlebar();
        var parent = TitleBar.parentNode;
        var oUL = parent.getElementsByTagName('UL');
        var oLI = oUL[0].getElementsByTagName('LI'); //Get the unordered list html element
     
        if (oLI[0].id != "HelpListItem") { //If first (list item) does not have the id of "HelpListItem"
            var newLI = oLI[0].cloneNode(true);
            var newA = newLI.getElementsByTagName('a'); //html anchor
            oUL[0].style.width = "93px"; //width of titlebar
            newA[0].className = "helpbutton"; //class inside .css file
            newA[0].title = "Help Button";
            newA[0].lastChild.innerHTML = "Help Button";
            newA[0].onmousedown = callHelpFunction;
     
            if (radWindowDom.attributes["HelpId"] != null) {
                newA[0].setAttribute("helpId", radWindowDom.attributes["HelpId"].value);
            }
     
            oUL[0].insertBefore(newLI, oLI[0]);
            oLI[0].id = "HelpListItem"; //Name the first (list item) ID to "HelpListItem"
        }
    }
     
    function callHelpFunction(e) {
     
        //Do something
     
        //Cancel event!
        if (!e) e = window.event;
        return $telerik.cancelRawEvent(e);           
    }
     
    <asp:Button Id="button1" runat="server" Text="Open Rad Window2" OnClientClick="showRadWindow(); return false;" />
     
    <telerik:RadWindowManager id="radWindowManager" runat="server">
            <windows>
                     
                <telerik:RadWindow
                    id="notesWindow"
                    Runat="server"
                    Behaviors="Close, Move, Resize, Maximize"
                    ReloadOnShow="true"
                    VisibleStatusbar="true"
                    ShowContentDuringLoad="false"
                    Width="440px" Height="440px"
                    Left="250px"
                    Modal="true"
                    EnableEmbeddedSkins="false"
                    Skin="mySkin"
                    EnableEmbeddedBasestylesheet="false"
                    OnClientShow="AddHelpIcon">
                </telerik:RadWindow>           
            </windows>
        </telerik:RadWindowManager>
  2. Duy
    Duy avatar
    18 posts
    Member since:
    Nov 2008

    Posted 17 Sep 2010 Link to this post

    I noticed if I set an JS alert in my callHelpFunction function, and close the window after the alert pops up, it DOES NOT maximize the window. Strange huh?

    Anyone?
  3. Duy
    Duy avatar
    18 posts
    Member since:
    Nov 2008

    Posted 20 Sep 2010 Link to this post

    I am still having trouble with this if anyone can PLEASE help.
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Sep 2010 Link to this post

    Hello Duy,

     I prepared a sample demo based on your code but unfortunately to no avail. Would you please examine my page and let me know what I am doing wrong? Once I am able to observer the issue locally I will do my best to help.

    Sincerely yours,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Duy
    Duy avatar
    18 posts
    Member since:
    Nov 2008

    Posted 23 Sep 2010 Link to this post

    Can you try removing the alert so that when you click on the help button, nothing happens? I used your code and I was able to recreate the issue when I removed the JS alert in the callHelpFunction function.

    Also are you using the following?

    Telerik.Web.UI V: 2009.2.701.20
    Using IE8 in Browser mode: IE8 Document mode: IE 8 Standards

    Thanks for your assistance!
  6. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 28 Sep 2010 Link to this post

    Hello Duy,

     Thank you for the provided additional details, the issue comes from the fact that you have cloned the maximize button. If you want to use the clone, you should take care of clearing the attached handlers, etc, and to make sure that the button is not inside the buttons array in the window.

    However, since this is more complex solution and also might need custom code I recommend to simply create new elements as explained in the article below instead of cloning:

    http://www.telerik.com/support/kb/aspnet-ajax/window/adding-a-custom-button-to-radwindow-titlebar.aspx

    All the best,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top