Welcome to the Xceed Community | Help
Community Search  
More Search Options

Getting the values of two column in a one column..

Sort Posts: Previous Next
  •  09-04-2008, 6:57 AM Post no. 14878

    Getting the values of two column in a one column..

    Hi,

    I am binding the DataGridControl from code behind using datagridcollectionview.....Suppose my datatable contains 5 columns . Now in the xceed grid i want to display the values of 1st and 3rd column in the same header i.e. in one column . How can i achieve this ?????

  •  09-04-2008, 8:56 AM Post no. 14892 in reply to 14878

    Re: Getting the values of two column in a one column..

    Although not recommended, you can change the CellContentTemplate of one of the columns to display all 3 values. Keep in mind that this will prevent the values from being editable.
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-04-2008, 12:58 PM Post no. 14914 in reply to 14892

    Re: Getting the values of two column in a one column..

    can u plz write a sample code.........

    I tried to do like this but it dint worked .........

    <xcdg:DataGridControl Grid.Row="5" Grid.RowSpan="6" AutoCreateColumns="False">
                    <xcdg:DataGridControl.Columns>
                        <xcdg:Column FieldName="AppTime" Title="App Time" Width="70"></xcdg:Column>
                    <xcdg:Column FieldName="Reasonforvisit" Title="Reason For Visit"></xcdg:Column>
                    <xcdg:Column FieldName="Department" Title="Department" Width="100"></xcdg:Column>
                   
                    <xcdg:Column FieldName="checkintype" Title="Checkin Status" Width="95"></xcdg:Column>
                    <xcdg:Column FieldName="variable" Title="Progress" Width="280" ReadOnly="True">
                        <xcdg:Column.CellContentTemplate>
                            <DataTemplate>
                                <TextBox Text="{xcdg:CellEditorBinding}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </xcdg:Column.CellContentTemplate>
                    </xcdg:Column>
                </xcdg:DataGridControl.Columns>
           
                </xcdg:DataGridControl>

  •  09-05-2008, 5:08 PM Post no. 14957 in reply to 14914

    Re: Getting the values of two column in a one column..

    The CellEditorBinding extension is used for cell editors, not cell-content templates. Change it to a standard binding and you should be fine.
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-08-2008, 9:59 AM Post no. 15001 in reply to 14957

    Re: Getting the values of two column in a one column..

    By CellEditorBinding i am also able to get the value but the problem is how can i get the values of multiple columns in one column ....... I tried to use the standard binding but thats returning a NULL ....... I guess that is because i am binding the gridCollectionViewSource dynamically from code behind ... Can u give me a solution for that having a dynamic datasource as DATASET. or datatable.....

    Thanx

  •  11-10-2008, 3:50 PM Post no. 16768 in reply to 15001

    Re: Getting the values of two column in a one column..

    I have a need for something similar.  I have a custom user control as the cell editor.  I need to bind to one column to control various behaviors of the control, and I need to bind to a second column to control the text that is displayed to the user.  Assume that I'm binding to a data table with at least two columns, OrderNumber & OrderStatus. The Grid Columns have already be generated based on the content of the datatable by the point this code runs.  The column that is bound to the Order status field is the field that the code runs against.

     

    CellEditorBindingExtension ex = new CellEditorBindingExtension();

    FrameworkElementFactory factory = new FrameworkElementFactory();

    factory.Type = typeof(StatusUserControl);

    Binding b = new Binding();

    b.Path = new PropertyPath("OrderNumber");

    factory.SetBinding(StatusUserControl.DisplayValueProperty, b);

    factory.SetBinding(StatusUserControl.ValueProperty, ex.ProvideValue(null) as BindingBase);

    DataTemplate template = new DataTemplate();

    template.VisualTree = factory;

    template.Seal();

    orderStatusColumn.CellContentTemplate = template;

     

    My problem is that the binding doesn't get set, and the following output is shown in the output window:

    System.Windows.Data Error: 39 : BindingExpression path error: 'OrderNumber' property not found on 'object' ''String' (HashCode=-842352673)'. BindingExpression:Path=OrderNumber; DataItem='String' (HashCode=-842352673); target element is 'StatusUserControl' (Name=''); target property is 'DisplayValue' (type 'Object')

    Because of the nature of this project, this has to be done in C#.  Any ideas?

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.