[CLOSED] Problem with Page.X() and masterpages

  1. #1

    [CLOSED] Problem with Page.X() and masterpages

    I use Page.X()... to dinamically create a window with a grid inside. When the page doesn't have a master page it works normally. When i use a masterpage, i get javascript errors saying that the store was not found by it's id; After the error the window is shown.
    There is also a button that when clicked calls "mywindow.hide()" to hide the window. When i don't use a masterpage it works ok, but when i use a masterpage i get an error saying "mywindow" doesn't exist.

    I guess it has something to do with the controls created with Page.X() being set with client ids differently when using a master page, but i have no idea on how to fix it.
    Last edited by Daniil; Jun 08, 2012 at 9:06 PM. Reason: [CLOSED]
  2. #2
    MasterPage is INamingContainer therefore ID doesn't equal .ID (.ClientID is used on the client side)
    You can set IDMode="Static" for a widget to ensure ID == ClientID
    Last edited by geoffrey.mcgill; Jun 08, 2012 at 7:06 PM.
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Are you talking about clientidmode from asp.net 4.0 or an ext.net property?
    Where can i set this?
  4. #4
    Hi,

    When the Control is placed inside a MasterPage, the MasterPage is going to change the client-side .ID of the Control. This is the default functionality of ASP.NET. If you're server-side .ID is "mywindow", then you're client-side .id will be something like "ctl001_mywindow".

    You can get the client-side side .id, by calling the .ClientID property on the server-side instance of the Window. Such as the following...

    Example

    this.Label1.Text = this.mywindow.ClientID;
    That will print out the .ClientID of the Window. You can then use that client-side .id in your client-side JavaScript code,

    Example

    ctr001_mywindow.hide();
    The client-side prefix added by the MasterPage will almost certainly not be "ctr001_", so you'll have first find the client-side .id by getting the .ClientID property.

    Hope this helps.
    Geoffrey McGill
    Founder & CEO
  5. #5
    Hi Geoffrey,

    I know, in asp.net 4 i could solve this using clientidmode = static for example. Just was not sure how to do the same in coolite, but already figured it out.

    That's what i did:

    ...
                    Window WinError = page.X().Window()
                                        .ID("WinShowErro")
                                        .Height(185)
                                        .Width(500)
                                        .Layout("Fit")
                                        .Modal(true);
    
                    WinError.IDMode = IDMode.Static;
    ...
    Seems to work fine.

Similar Threads

  1. [CLOSED] ViewState and MasterPages
    By wisdomchuck in forum 1.x Premium Help
    Replies: 1
    Last Post: May 20, 2011, 7:58 PM
  2. Problem With editor in MasterPages & User web Control
    By firebird_design in forum 1.x Help
    Replies: 2
    Last Post: Sep 08, 2010, 1:57 PM
  3. [CLOSED] IE7 page rendering problem?
    By danielg in forum 1.x Premium Help
    Replies: 43
    Last Post: Mar 24, 2010, 4:54 PM
  4. [CLOSED] FitLayout & masterpages
    By GmServizi in forum 1.x Premium Help
    Replies: 5
    Last Post: Oct 22, 2009, 6:11 AM
  5. Replies: 1
    Last Post: Feb 15, 2008, 10:06 AM

Posting Permissions