[CLOSED] TreePanel DirectEvent BehindCode

  1. #1

    [CLOSED] TreePanel DirectEvent BehindCode

    I have created a TreePanel in behindcode and would like to add a directevent when an item is clicked. I lost on how to do this.

    ...
    Ext.Net.TreePanel YearPanel = new Ext.Net.TreePanel();
    YearPanel.Title = "Some Year";
    YearPanel.Icon = Icon.Calendar;
    YearPanel.BodyPadding = 5;
    YearPanel.RootVisible = false;
    
    //Something like ...
    //YearPanel.DirectEvents.ItemClick.Method ???
    ...
    Last edited by Daniil; Oct 17, 2012 at 6:30 PM. Reason: [CLOSED]
  2. #2
    I have attempted the following but receiving an exception that "The control with ID'ctl00_CenterContent_ctl53' is not Observable"

    
       private void BuildTreePanel ()
       {
          Ext.Net.TreePanel YearPanel = new Ext.Net.TreePanel();
          YearPanel.Title = "Some Year";
          YearPanel.Icon = Icon.Calendar;
          YearPanel.BodyPadding = 5;
          YearPanel.RootVisible = false;
    
          YearPanel.DirectEvents.ItemClick.Event += OverviewItemClicked;
    
          ....
          //Additional code that adds the tree panel to the page and other stuff.
       }
     
       protected void OverviewItemClicked(object sender, DirectEventArgs e)
       {
           // Add code here because of the item clicked
       }
  3. #3
    Please close the thread. I was calling the BuildTreePanel from Page_Load but wrapped around

    protected void Page_Load(object sender, EventArgs e)
    {
       if (!X.IsAjaxRequest)
          BuildTreePanel();
    }
    I have change the Page_Load
    protected void Page_Load(object sender, EventArgs e)
    {
       BuildTreePanel();
    
       if (!X.IsAjaxRequest)
       {
       }
    
    }
  4. #4
    Hi Chris,

    Yes, DirectEvent requires a control instance.

Similar Threads

  1. Replies: 1
    Last Post: Jun 09, 2011, 7:04 PM
  2. [CLOSED] Adding a button directevent in a directevent method
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2011, 10:29 AM
  3. [CLOSED] Send all treepanel nodes to directevent as extraparam
    By KorsG in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 09, 2011, 4:57 PM
  4. [CLOSED] TreePanel DirectEvent CheckChange
    By ashton.lamont in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 10, 2010, 4:44 AM
  5. [CLOSED] [1.0] TreePanel add node at DirectEvent
    By methode in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 08, 2009, 1:56 PM

Posting Permissions