codecompleting
codecompleting

Reputation: 9611

How to access the current row's data in telerik's grid?

I have a grid, and say I am in given telerik:GridTemplateColumn (or GridboundColumn?) I want to display the result of 2 other columns, how would I do this?

In asp.net repeater I could do:

<%# Container.DataItem("Col3") %> <%# Container.DataItem("Col4") %>

How would I do this in a telerik grid?

Upvotes: 1

Views: 678

Answers (1)

Stephen McDaniel
Stephen McDaniel

Reputation: 2968

You should be able to use very similar syntax. Inside the GridTemplateColumn, you need to make an ItemTemplate. In that, you can put whatever markup you want to be displayed in the column. For example:

<telerik:GridTemplateColumn HeaderText="Col3 and 4" UniqueName="TemplateColumn">
    <ItemTemplate>
        <%# Container.DataItem("Col3") %> <%# Container.DataItem("Col4") %>
    </ItemTemplate>
</telerik:GridTemplateColumn>

For more information, you can reference the documentation for the various column types: http://www.telerik.com/help/aspnet-ajax/grid-column-types.html (you'll need to scroll down a ways to get to the section on GridTemplateColumn.

Also, I'm assuming you are using Visual Basic? Otherwise, I think the syntax would be different.

Upvotes: 1

Related Questions