Gridview隐藏colomn而没有错误 [英] Gridview hide colomn without error
本文介绍了Gridview隐藏colomn而没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Webform应用程序中有一个GridView。我已经定义了aspx页面中的所有列。
在一个场景中,我的逻辑没有返回aspx页面中定义的一列如下:
I have a GridView in Webform application. I have defined all the columns in the aspx page.
In one scenario my logic is not returning one column that is defined in aspx page as following:
<asp:TemplateField HeaderText="Inventory Status">
<ItemTemplate>
<asp:Label ID="lblInventoryStatus"
CssClass="rptheadingwithBottom" runat="server" Text='<%# Bind("Inventory Status")%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
The
Inventory Status
列未返回因此产生错误在代码中。我想知道的是除了
Column is not returning thus generating error in code. What i want to know is there any way other than
AutoGenerateColumns= true
以外的任何其他方式来显示此列或根据逻辑隐藏此列。
我尝试过:
无法找到解决方案
to display this column or hide this column based on logic.
What I have tried:
Nothing Unable to find the solution
推荐答案
尝试在列中添加类
并将display
样式添加到显示/隐藏
列
try adding aclass
to the column and add thedisplay
style toshow/hide
the column
嗨..,
设置AutoGenerateColumns = false
列名无空间使用InventoryStatus
你可以尝试这种方式
< ; asp:Label ID =lblInventoryStatus
CssClass =rptheadingwithBottomrunat =serverText ='<%#Eval(InventoryStatus)%>'>
Hi..,
Set AutoGenerateColumns= false
Column Name use without space InventoryStatus
You can try this way
<asp:Label ID="lblInventoryStatus"
CssClass="rptheadingwithBottom" runat="server" Text='<%#Eval("InventoryStatus") %>'>
</asp:Label>
这篇关于Gridview隐藏colomn而没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文