开发者

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

开发者 https://www.devze.com 2023-04-01 17:01 出处:网络
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?

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") %> <%# C开发者_运维百科ontainer.DataItem("Col4") %>

How would I do this in a telerik grid?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消