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
300
WebDialogWindow Javascript Error
posted

I am using asp.net 2.0 infragistics controls 2008 vol 2.
When i try to set the caption text of a WebDialogWindow using javascript i have the following issues.

1) First i get a reference of the dialog window using var Dialog = $find(DialogControlId);

2) When i use Dialog.get_header() to get the header element null is returned. If i use instead Dialog._header i manage to reach the header element. But then again when i use Dialog._header.setCaptionText('Some Caption') an exception 'this._elems.7' is null or not an object Error' is thrown.

I managed to set the caption by using

Dialog._header.get_element().getElementsByTagName('span')[0].innerText = 'Some Caption';

but i think this is not the way it should work.

Please let me know if this a minor javascript bug or there is something i am missing.

Kind regards,
Kostas

  • 2700
    Offline posted

    I had the same problem setting the title and found that I could not get the header before showing the dialog - I was using this as a pop-up add/edit item window).  As such my code was:-

     

     

     

     

     

     

    var 

     

     

    oWebDialogWindow1 = $find('<%= newuserPopup.ClientID %>');
    ShowPopup(
    true)
    var header = oWebDialogWindow1.get_header();
    if (header == null)
        a
    lert ("No header found");
    else
       
    header.setCaptionText("Edit User");

    This seems to work fine for me

  • 135
    posted

    Hi, you can set the Caption of a webdialogwindow without use javascript like this

    <ig:WebDialogWindow runat="server" Width="800px" Height="500px" ID="WebDialogWindow " InitialLocation="Centered" Moveable="true" Modal="true" >

    <Header CaptionText = "My Title"></Header>

    </ig:WebDialogWindow>

  • 25
    posted

     Hey Kostas!

    Here is how I was able to set the CaptionText of a WebDialogWindow in a quick sample I just built.

    In the WebDialogWindow I first added a ClientEvent Initialize...

    <ClientEvents Initialize="Init" />

    Then I added the function Init(); to my JavaScript portion of my document.

    <script type="text/javascript">
           function Init() {
               var dialog = $find('<%=WebDialogWindow1.ClientID%>');          
               var header = dialog.get_header();
               header.setCaptionText('TEST');
           }
    </script>


    The ID of my WebDialogWindow is "WebDialogWindow1" so in the Javascript, just change that
    to whatever your WebDialogWindow is, also I had to add that to the Initialize event because
    I tried to use "var dialog = $find('<%=WebDialogWindow1.ClientID%>');" but it was being called
    before the WebDialogWindow was even finished being created on the Client, so it kept returning
    back to be "null" .

    I hope this helps.

    Just let me know!

    -Tim

  • 410
    posted

    Kostas,

    Sorry, I can't be of much help here, but I think that you want to use innerHTML instead of innerText.  I believe that innerText is IE-only.

    Good luck,

    -Eric