使用ASP.NET中的“设计页面"显示/隐藏GridView列 [英] Show / Hide GridView Columns using Design Page in ASP.NET

查看:126
本文介绍了使用ASP.NET中的“设计页面"显示/隐藏GridView列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ASP.NET中的设计页面"显示/隐藏GridView列?



< asp:GridView ID = "  runat = "  AutoGenerateColumns = " 错误" BorderWidth =   1px"
                                              BorderColor = "  CellPadding = "  2" ForeColor =  黑色" AllowPaging = "  PageSize = "  10" 

...........

 <   asp:BoundField     DataField   ="  CONTACTNO"     HeaderText   =" 联系方式" <   ItemStyle     ="   17%"  Horizo​​ntalAlign   居中"    / > 
                                                     <   HeaderStyle     ="   Center"  VerticalAlign   中间"   / > 
                                                 <  /asp:BoundField  >  

解决方案

如果将可见"属性设置为true或false,则可以使列可见或不可见


if您使用visible false表示隐藏的列值没有得到.使用Css隐藏列.
CSS代码为

 <  样式   类型  ="    > 
    .隐{
    显示:无;
    }
 <  /style  >  



在boundfield标签或隐藏的列标签中添加CSS类
ItemStyle-CssClass ="hidden"


Plz通过此链接获取

在ASP.NET中显示/隐藏GridView列

Show / Hide GridView Columns using Design Page in ASP.NET ?



<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" BorderWidth="1px"
                                              BorderColor="#D2DBE7" CellPadding="2" ForeColor="Black" AllowPaging="true" PageSize="10"

..........

<asp:BoundField DataField="CONTACTNO" HeaderText="Contactno">
                                                     <ItemStyle Width="17%" HorizontalAlign="Center" />
                                                     <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                 </asp:BoundField>

解决方案

you can make columns visible or invisible by setting "Visible" attribute to true or false


if your using visible false your hidden column value not getting.Use Css to hide the column.
css code is

<style type="text/css" >
    .hidden{
    display:None;
    }
 </style>



add css class in boundfield tag or your hidden column tag
ItemStyle-CssClass="hidden"


Plz got through this link

Show / Hide GridView Columns in ASP.NET


这篇关于使用ASP.NET中的“设计页面"显示/隐藏GridView列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆