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
20
UltraGrid with UltraTree in UltraTextEditor
posted

I currently have an UltraGrid bound to a custom object:

public class Person

{

   public string FirstName { get; set;}

   public string LastName { get; set; }

   public int CategoryId { get; set; }

}

 

The UltraGrid's Category column's ValueList property is set to a UltraDropDown like so:

 

 

 

 

 

uddCategories =

new Infragistics.Win.UltraWinGrid.UltraDropDown();

 

uddCategories.ValueMember =

"CategoryId";

uddCategories.DisplayMember =

"Code";

uddCategories.DataSource = categories; // this is a list of category objects

 

 

ugContent.DisplayLayout.Bands[0].Columns[

"CategoryId"].ValueList = uddCategories;

 

 

Now our categories are going to be grouped into Super Categories and the we wish to display them in a hierarchical  manner.

SuperCategoryA

     Category1

     Category2

SuperCategoryB

     Category3

     Category4

and so on...

 

I wish to accomplish this using an UltraTextEditor and an UltraTree.  So far I have managed to get the categories in the Tree and the Tree into the UltraTextEditor and into the appropriate cell of the grid. 

Now I need to get the Category code into the UltraTextEditor's text property based on the CategoryId of the row.  I also need to select the appropriate Node in the UltraTree based on the CategoryId of the row.  Is there a way to bind these values through existing properties?

 

Any guidance or advice is appreciated,

Thanks.

Parents
  • 469350
    Offline posted

    Hi,

    There's no way to "bind" properties, you have to handle these things in code.

    Updating the Text or Value of the UltraTextEditor control won't do anything, because the grid doesn't actually use this control. The UltraTextEditor provides a copy of it's own internal editor for the grid to use.

    So what you have to do is update the value of the grid cell. To make this work like a regular dropdown, you will probably want to use the NodeClick event of the tree and inside this event, update the cell in the grid. The easiest way to do this in a simple case is to simply use the ActiveCell property of the grid and set it's Value property.

    If you have more than one instance of your dropdown and more than one grid, then things can get a bit more complex, but most of the time, the ActiveCell approach will work just fine.

     

    In terms of selecting the appropriate item in the tree when you drop down the list, a typical dropdown does this whenever the user drops it down. So to handle this, you would typically trap the BeforeEditorButtonDropDown event on the UltraTextEditor. Here you can select and/or activate whatever item you want in the tree. To determine which cell in the grid is dropping down, you use the e.Context property on the event args. It passes you the cell.

Reply Children
No Data