This is a migrated thread and some comments may be shown as answers.

Clicking on custom button with RadWindow maximizes the window

5 Answers 101 Views
Window
This is a migrated thread and some comments may be shown as answers.
Duy
Top achievements
Rank 1
Duy asked on 17 Sep 2010, 02:47 AM
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>

5 Answers, 1 is accepted

Sort by
0
Duy
Top achievements
Rank 1
answered on 17 Sep 2010, 07:47 PM
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?
0
Duy
Top achievements
Rank 1
answered on 21 Sep 2010, 03:32 AM
I am still having trouble with this if anyone can PLEASE help.
0
Svetlina Anati
Telerik team
answered on 23 Sep 2010, 08:19 AM
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
0
Duy
Top achievements
Rank 1
answered on 23 Sep 2010, 05:18 PM
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!
0
Svetlina Anati
Telerik team
answered on 28 Sep 2010, 01:40 PM
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
Tags
Window
Asked by
Duy
Top achievements
Rank 1
Answers by
Duy
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or