Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
400
WebDialogWindow Header Text change in JavaScript
posted

How do I change the header text on a WebDialogWindow in Javascript.

I have tried this.

var oWebDialogWindow = $find('ctl00_CL_ContentPlaceHolder_wpMyAccount_wdwMessages');

var header = oWebDialogWindow.get_header();

header.setCaptionText(hdnSubject.value);

However, it keeps telling me that the header is null.

  • 540
    posted

    Hey there, this is for anyone else coming across this post.  This seems to work for me in version 10.2: (Just a note, that I had actually set the Caption Text to a default text value in the designer that I changed in the code below)

    var

     

     

     

    dialog = $find('<%= wdw_OTPDExclusions.ClientID %>'

    );

    dialog._elements[1].innerHTML =

     

    "PD Preferences";

  • 24497
    posted

    Hi,

    The header is accessible after dialog was initialized. For example, you may process ClientEvents.Initialize and implement it by something like below:

    function initDialog1(dialog, evtArgs)
    {
      dialog.get_header().setCaptionText(
    'Client Caption');
    }

    You also may try to use internal member dialog._header, but while initialization it can be reset, so, your codes may have no effect or raise exception.

     

  • 65
    posted

    Have you found a solution for this? From what I have seen the function get_Header returns null if the dialogwindow is not in a "ready" or apparently "hidden" state.

    I was able to change the header using this:

    var webDialogWindow = $find('<%= webDialogWindow.ClientID %>');
    webDialogWindow._header._props[0] =
    "My header";

    I also tried the following:

    var webDialogWindow = $find('<%= webDialogWindow.ClientID %>');
    webDialogWindow.set_windowState(0x0);
    webDialogWindow._header.setCaptionText(
    "My Header");

    http://forums.infragistics.com/forums/p/6584/27883.aspx

    Setting the caption after showing the dialog also solves this problem:

    var webDialogWindow = $find('<%= webDialogWindow.ClientID %>');
    webDialogWindow.show();
    webDialogWindow._header.setCaptionText(
    "My Header");