【发布时间】:2021-04-19 20:55:02
【问题描述】:
在我的 ASP.NET 网格视图中,我已将标签 lbannotation 作为默认值插入:
<asp:TemplateField HeaderText="annotation"
ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lbannotation" runat="server"
Text='<%# Eval("tannotation").ToString() %>'
CssClass="ddl_Class_new"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
如果是数据库表列的字符串tannotation:
Eval("tannotation").ToString()
在我们的字符串中包含单词ready
我需要从asp:Label更改
<asp:TemplateField HeaderText="annotation"
ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lbannotation" runat="server"
Text='<%# Eval("tannotation").ToString() %>'
CssClass="ddl_Class_new"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
致asp:TextBox
<asp:TemplateField HeaderText="annotation"
ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:TextBox ID="txannotation" runat="server"
Text='<%# Eval("tannotation").ToString() %>'
CssClass="ddl_Class_new"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
我应该为这个需要设置什么?
protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataItem != null)
{
????
}
}
}
帮我做。
【问题讨论】: