开发者

gridview databind

I'm doing a gridview with an object datasource:

List<MyObject> TheSource = a linq query

At some point, I have

MyGridview.DataSource = TheSource;
MyGridview.Databind();

and an OnRowDataBound event handler that's tied to the databinding.

In that event handler, how do you m开发者_StackOverflow社区ake column 2 contain 2 objects from TheSource. For instance, in the TheSource, there is a variable for FirstName and another one for LastName. Column 2 needs to contain both the first and last name in the same cell.

Thanks.


<asp:TemplateField HeaderText="Full Name">
    <ItemTemplate>
        <span>
            <%# Eval("FirstName").ToString() +' '+ Eval("LastName").ToString()%>
         </span>
     </ItemTemplate>
 </asp:TemplateField>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜