How to access masterpage control from ChildPage.

  1. #1

    How to access masterpage control from ChildPage.

    I've got ext:button defined in Masterpage. And from my child View page am accessing it like this

     var btn = Ext.getCmp('Button1');
    But am getting undefined error

    Microsoft JScript runtime error: 'undefined' is null or not an object
    How can i access Master page control from ChildPage.

    Am using same Masterpage layout as in ext.MVC Northwind example.
    Last edited by geoffrey.mcgill; Nov 04, 2010 at 8:06 AM. Reason: please use [CODE] tags
  2. #2
    Any Luck in getting this worked i am in the same situation and i need to get it working
  3. #3
    When you reference the components in JavaScript, you must use the components client-side ID. The client-side ID will be same as the .ClientID property of the component. The .ID and .ClientID of the component may not (will not if using masterpages) be the same.

    Example

    this.Button1.ClientID;
    If you add the following to your page, you should be able to render the .ClientID inline.

    Example

    var btn = Ext.getCmp('<%= Button1.ClientID %>');
    Another option, set .IDMode="Explicit" on the Button. This will force the client-side ID to *always* be "Button1". You must manually ensure only one "Button1" is present on the page at a time with this method.

    Hope this helps.
    Geoffrey McGill
    Founder
  4. #4
    Hey Geoffrey

    Thanks for your quick response but this doesn't seem to be working here for me.

    Let me tell you whats going on here.

    I have aspx which inherits a master page and the master page has a tab panel, menu control and everything works fine till here.

    Now i have another page which has a grid and click on a link in the menu opens this page in a tab and everything works fine here too.

    Now when clicked on a row in the grid i want to open the details of the item as a new tab using the same tab panel in the above master page.

    Problem is that obviously the page having the grid doesn't have anything to do with the master page or the page its being used to display so its not working and the other problem is that in my case

    var tp = Ext.getCmp('tpMain'); this works only when being used in the master page but not in the grid page

    var tp = Ext.getCmp('<%= tpMain.ClientID %>'); this doesn't work at all.

    Please help since we are kind of stuck here.

    Also is there a place i can find some documentation about the user controls and stuff ?
  5. #5

    Hi Sampathch,

    Quote Originally Posted by sampathch123 View Post
    Hey Geoffrey

    Thanks for your quick response but this doesn't seem to be working here for me.

    Let me tell you whats going on here.

    I have aspx which inherits a master page and the master page has a tab panel, menu control and everything works fine till here.

    Now i have another page which has a grid and click on a link in the menu opens this page in a tab and everything works fine here too.

    Now when clicked on a row in the grid i want to open the details of the item as a new tab using the same tab panel in the above master page.

    Problem is that obviously the page having the grid doesn't have anything to do with the master page or the page its being used to display so its not working and the other problem is that in my case

    var tp = Ext.getCmp('tpMain'); this works only when being used in the master page but not in the grid page

    var tp = Ext.getCmp('<%= tpMain.ClientID %>'); this doesn't work at all.

    Please help since we are kind of stuck here.

    Also is there a place i can find some documentation about the user controls and stuff ?
    you mentioned that you are adding the child pages dynamically to tabs from the master page..would you please give me the code for me to refer i am trying to implement the similar feature and unsuccessful..
    i have a menupanel in my masterpage and on click of the items in the menu i want the child pages to be opened in new tabs.would you please help..i am totally new here and gone through some examples but from masterpage to child page nothing seem to be working with me.Please Help.

Similar Threads

  1. [CLOSED] dynamically control is rendered out of masterpage
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 10, 2011, 1:16 PM
  2. [CLOSED] Ext. Control with MasterPage
    By sisa in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 08, 2011, 4:15 PM
  3. Replies: 7
    Last Post: Apr 14, 2011, 10:52 PM
  4. Replies: 1
    Last Post: Mar 09, 2010, 2:55 AM
  5. Replies: 2
    Last Post: Aug 27, 2009, 8:12 AM

Tags for this Thread

Posting Permissions