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

Binding button content in GridViewDataColumn

5 Answers 191 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cody
Top achievements
Rank 1
Cody asked on 20 Jan 2012, 11:37 PM

I want to make a column in my RadGridView clickable, such that clicking on a cell in a particular column opens another view with details for that row. I tried adding a button to the column, but I can't get the button to show the text from the actual column. I've got my RadGridView  bound to a System.Data.DataTable, and am defining the column as follows:

<telerik:GridViewDataColumn Header="Action" DataMemberBinding="{Binding commandName}" UniqueName="actionButton">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <telerik:RadButton Content="{Binding commandName}" Click="ActionClicked" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

...but the button shows up as a skinny horizontal line with no text. It shows up as expected if I hard code the button content.

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 21 Jan 2012, 07:27 AM
Hello,

 Is the column bound the right way if you do not have a CellTemplate defined for it?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Cody
Top achievements
Rank 1
answered on 22 Jan 2012, 12:24 AM
Yes, it shows the value of the commandName column.
0
Cody
Top achievements
Rank 1
answered on 24 Jan 2012, 01:46 AM
By the way, this is using version 2011.2.920.35
0
Accepted
Dimitrina
Telerik team
answered on 24 Jan 2012, 03:51 PM
Hello,

 The content for the button in the CellTemplate is bound fine with the "2011.2.920.35" as well. What is the result if you set the DataTable.DefaultView for an ItemsSource?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Cody
Top achievements
Rank 1
answered on 26 Jan 2012, 02:25 AM
Thanks, that worked!
Tags
GridView
Asked by
Cody
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Cody
Top achievements
Rank 1
Share this question
or