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
710
Set Master Detail Columns at design time
posted

Hi, i have a list like this

public class SOCabezaEntity
{
public string IdSales { get; set; }
public DateTime Fecha { get; set; }
public string Numero { get; set; }
public string Template { get; set; }
public int NumItems { get; set; }
public int Estado { get; set; }
public DateTime Procesado { get; set; }
public string Idcustomer { get; set; }
public string CustomerName { get; set; }
public List<SOItemsEntity> Items { get; set; }
}

public class SOItemsEntity
{
public string IdSales { get; set; }
public string IdItem { get; set; }
public string Fullname { get; set; }
public string Name { get; set; }
public double CantidadQB { get; set; }
public int EstadoQB { get; set; }
public int EstadoBR { get; set; }
public double CantidadBR { get; set; }
public string Orden { get; set; }

}

I have a method that gets a list of SO, but i need change the columns names in the ultragrid.

When i click in my start button for beging designing the ultragir, y do not know how i can add the Items column for may entity. What type should be this column? I need hide any columns for my Detail (IdSales, EstadoWB,EstadoBR,Orden).

How i can add the detail columns in my grid??

  • 21795
    Offline posted

    Hello Fernando,

    Thank you for posting in our forum.

    In order to set up the grid data schema in design time you need to:

    1. Click on start button of the grid in the designer;

    2. Click on Basic Settings -> Data Schema in the selection tree on the left side of UltraGrid Designer window;

    3. Click on Manually Define Schema button.

    This will open Edit Schema window. Here you can add all the columns you have in your custom classes. After you set up the schema you can go to Bands and Column Settings in UltraGrid Designer Window. Here you can set the columns headers captions (the title of the columns displayed at runtime) as well as columns hidden property.

    If you need to set up the grid at runtime you may handle InitializeLayout event. In this event the event argument has Layout property. Via this property you may setup the entire layout of the grid. To change the column header caption and to make a column hidden you may use code lie this:

    // Hide the IdSales column from SOCabezaEntity parent band
    var idSalesColBand0 = e.Layout.Bands[0].Columns["IdSales"];
    idSalesColBand0.Hidden = true;
     
    // Change the caption of Fecha column in SOCabezaEntity parent band
    var fechaCol = e.Layout.Bands[0].Columns["Fecha"];
    fechaCol.Header.Caption = "Some Custom Text";
     
    // Hide the IdSales column from SOItemsEntity child band
    var idSalesColBand1 = e.Layout.Bands[1].Columns["IdSales"];
    idSalesColBand1.Hidden = true;

    More about InitializeLayout event you may find by following the next link http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=WinGrid_InitializeLayout_Event.html.

    In the attached sample project I have implemented all this. Please check my sample and let me know if you need any additional information.

    Thank you for using Infragistics Controls.

    CAS-168234-S8H5C1_01.zip