修改Asp gridview边界字段

发布于 2024-08-18 14:16:10 字数 145 浏览 3 评论 0原文

我想在后面的代码中添加一些文本到绑定字段构建中,而不在后面的代码中编写任何代码。

例子 我在特定字段中收到“溢出”,并且我想显示“堆栈溢出”,如果我收到“房屋”,我想显示“堆栈房屋”

是否有一个属性可以将文本放在后面或后面的任何内容之后边界场?

I want to add some text to a boundfield build in the code behind without writing any code in the code behind.

example
I receive "overflow" in a specific field, and i'd like to display "stack overflow" and if i receive "house" i want to display "stack house"

is there a property to put text behind or after whatever comes in the boundfield ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幻梦 2024-08-25 14:16:10

使用自定义列。

  <asp:TemplateField HeaderText="MyColumn">
    <ItemTemplate> 
         stack <asp:Literal runat="server" Text="<%#Eval("myField")%>" />
    </ItemTemplate>
  </asp:TemplateField>  

Use a custom column.

  <asp:TemplateField HeaderText="MyColumn">
    <ItemTemplate> 
         stack <asp:Literal runat="server" Text="<%#Eval("myField")%>" />
    </ItemTemplate>
  </asp:TemplateField>  
千笙结 2024-08-25 14:16:10

注意

HtmlEncode=false

<asp:BoundField DataField="yourColumn" HeaderText="Your Header" DataFormatString="{0} overflow" HtmlEncode="false" SortExpression="GenCommission" />

notice

HtmlEncode=false

<asp:BoundField DataField="yourColumn" HeaderText="Your Header" DataFormatString="{0} overflow" HtmlEncode="false" SortExpression="GenCommission" />
挽清梦 2024-08-25 14:16:10

为什么不直接使用项目模板?

// instead of 
<asP:BoundField DataField="FieldName" />

// use
<asp:TemplateField>
<ItemTemplate>
    prefix <%# Eval("FieldName") %> suffix
</ItemTemplate>
</asp:TemplateField>

Why not just use item template?

// instead of 
<asP:BoundField DataField="FieldName" />

// use
<asp:TemplateField>
<ItemTemplate>
    prefix <%# Eval("FieldName") %> suffix
</ItemTemplate>
</asp:TemplateField>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文