在gridView中隐藏一列填充代码? [英] Hide a column in a gridView that is filled with code ؟

查看:65
本文介绍了在gridView中隐藏一列填充代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
如何(使用C#进行网络访问)?
在gridView中隐藏一个填充有dataBase的列
注意:
该数据库充满了GridView.
表示运行时的GridView列.
因此,请在运行,未知列之前.

hello
How can (web in C#)?
Hide a column in a gridView that is filled with dataBase
Note:
The database is filled with the GridView.
GridView columns at run time are denoted.
So، before you run ، the column not known.

推荐答案

尝试此代码

代码背后
try this code

Code Behinde
GridView1.DataBind();
        if (GridView1.Columns.Count > 0)
            GridView1.Columns[0].Visible = false;
        else
        {
            GridView1.HeaderRow.Cells[0].Visible = false;
            foreach (GridViewRow gvr in GridView1.Rows)
            {
                gvr.Cells[0].Visible = false;
            }
        }




请投票表决是否有帮助




please vote if this will help


这是winforms应用程序还是Web应用程序?我认为我们需要查看代码,但是,总的来说,隐藏列的方式是指定要显示的列,而不是让它们全部显示.我假设您可以从动态数据源中以编程方式即时执行此操作.我唯一看到的另一种方法是通过调整列的大小来隐藏该列.
This is a winforms app, or a web app ? I think we need to see the code, but, broadly, the way you hide a column is to specify the columns you want to show instead of having it show them all. I would assume that you could do that programatically on the fly from a dynamic data source. The only other way I could see, is to hide the column by resizing it.


谢谢
我正在使用网络.
GridView数据源未连接到sqlDataSource.
但是我在它可以工作的代码中有一个存储过程.
因此,当GridView列号为零时,您的代码将不起作用.
程序号为零个GridView列.
--------------------------------------------
摘要:我们存储了我们在GridView中编写的用于选择存储过程的参数和值.
GridView将包含七个列,而我们将不显示第七列.
Thank you
I am working with the web.
GridView DataSource is not connected to sqlDataSource.
But I have a stored procedure in the code it works.
So your code does not work when the GridView column number of zero indicates.
Program number is zero GridView columns.
--------------------------------------------
The summary: We storedprocedure parameter and value that we have written in the GridView to select storedprocedure.
GridView will include seven columns that we will not show the seventh column.


这篇关于在gridView中隐藏一列填充代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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