如何以编程方式添加模板字段 [英] How to add template field programatically
本文介绍了如何以编程方式添加模板字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:TemplateField HeaderText="Company">
<ItemTemplate>
<asp:Label ID="lbl_pcompany" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,"farmername") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtpcompany" Width="90px"
Text='<%#DataBinder.Eval(Container.DataItem,"farmername") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Product Type">
<ItemTemplate>
<asp:Label ID="lbl_pproducttype" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem,"villagename") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtpproducttype" Width="90px"
Text='<%#DataBinder.Eval(Container.DataItem,"villagename") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
##如何使用C#以编程方式添加这些列##
##How to add these columns programmatically using C# ##
推荐答案
在此处检查:
从代码隐藏中创建DetailsView [如何以编程方式添加TemplateField [
Check here:
Create DetailsView from codebehind[^]
and here
How to add TemplateField programmatically[^]
这篇关于如何以编程方式添加模板字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文