62,046
社区成员
发帖
与我相关
我的任务
分享
public protected string GetMyTR(string a,string b,string c, string d)
{
......
}
那么你应该这样绑定<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Label ID="lbl_TR" runat="server" Text='<%# GetMyTR((string)Eval("S_TR"),(string)Eval("ZY_TR"),(string)Eval("HY_TR"),(string)Eval("QT_TR"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
如果你可以通过数据源对象(例如数据实体类型叫做 MyEntity )来决定,例如public protected string GetMyTR(MyEntiry obj)
{
......
}
那么你也可以这样绑定<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Label ID="lbl_TR" runat="server" Text='<%# GetMyTR((MyEntity)Container.DataItem)%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>