This is a migrated thread and some comments may be shown as answers.

Updating CellTemplate to display lookup

1 Answer 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 28 Jul 2010, 12:42 AM
Hi:

I have a CellTemplate/CellEditTemplate column in a grid:

<radGridView:GridViewDataColumn Header="Project" DataMemberBinding="{Binding ProjectID, Mode=TwoWay}" >
    <radGridView:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding ProjName}" Loaded="TextBlock_Loaded" />
        </DataTemplate>
    </radGridView:GridViewDataColumn.CellTemplate>
    <radGridView:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <radInput:RadComboBox x:Name="cboProject" DisplayMemberPath="ProjName" Text="{Binding ProjName, Mode=TwoWay}"
                SelectedValue="{Binding ProjectID, Mode=TwoWay}" Loaded="cboProject_Loaded"  SelectionChanged="cboProject_SelectionChanged" />
        </DataTemplate>
    </radGridView:GridViewDataColumn.CellEditTemplate>
</radGridView:GridViewDataColumn>

The project RadComboBox is populated based upon a customer selected in another combobox column in the grid.

Right now, I am binding to a view WCF RIA collection so that I can get the project name (projname).  What I would really like to do is bind directly to the underlying TimeCharge table collection.  This will make it much easier to edit the contents.  The problem is that I want to display the project name (ProjName), not the ProjectID (an integer) in the textblock, but that field does exist in the TimeCharge table, only the ProjectID.  It is easy to show the descriptive project name in the combobox of the CellEditTemplate, but how do I make the textblock show this as well?

I am having a hard time explaining this.  Do you understand?  If so, do you have any good ideas for a solution? 

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 29 Jul 2010, 05:28 PM
Hi Terry,

Please provide us with more details about your project and its settings. Is there a reason for not using a GridViewComboBoxColumn and setting the CellTemplate and CellEditTemplate of GridViewDataColumn instead ? How exactly are you getting the "project name" in the ComboBox ?
It would be great if you could send us a sample project or paste the main part of your code considering the issue.
 

Sincerely yours,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Terry
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or