C# .NET - how can i make a column in a gridview invisible
Asked By grace paul on 23-Sep-08 06:09 AM
hi all,
how can i make a column in a gridview invisible after binding data to it.
Make a column invisible in Gridview
Shailendrasinh Parmar replied to grace paul on 23-Sep-08 06:24 AM
You can make it invisible at the time of declaring it in aspx page like this
<asp:BoundField DataField="I_Empid" Visible="false"></asp:BoundField>
And you can make it invisible at Page_load event after binding it
gridview1.Columns[1].Visible = false;
You have to supply the index of the column to make it invisible.
Hope it helps.
can't get the value in the invisible column
grace paul replied to Shailendrasinh Parmar on 23-Sep-08 07:08 AM
hi ,
i tried it. but i can't get the inside the invisible column for further procesing. It returns a null value.i don't know why it happens so..maybe of it's invisibility.
Try out first with making it visible
Shailendrasinh Parmar replied to grace paul on 26-Sep-08 06:31 AM
No, thats is not possible. If the value is null, then only it will return null value. It will not return null because of its invisible status.
Please check the database table, it the value from it is coming or not...
You can first try with making the column visible and check whether you are getting value or not... i am sure that you won't get value
for that null column value.... Please check it.
Hope this helps.

I have a gridview.there are 2 columns on page load one of the column should be invisible.On button click that column should be visible. . .i tried using lable item template inside the gridview. . and made insertvisible of that lable false. . . . how to make it visible using coding. dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = MyDataSet; dataGridView1.Columns[MyColumnHeaderName].Visible = false; / / Setting Invisible dataGridView1.Columns[MyColumnHeaderName].Visible = true; / / Setting visible hi, try the following code / / hide the column
How to get the text value of a column that is set to visible = false in a databound grid view? Eg: in the webpage trying the following (here, the datafield I am trying to access is for the first column): StringBuilder str = new StringBuilder(); foreach (GridViewRow gRow in GridView1.Rows) { str.Append(gRow.Cells[0 get is ;;;;; But if I try the same for Cells[1] which is a visible column, I get the value. Thx, Saritha http: / / gridviewguy.com / ArticleDetails.aspx?articleID = 87 this is was looking for! thnx a bunch! Saritha keywords: Visual Studio .NET, GridViewRow, StringBuilder, BoundField, visible column description: Gridview, invisible column value How to get the text value of a column that is set
how to retrieve invisible column values of grid view You have two approaches to do this. . check this article on www.gridviewguy.com / ArticleDetails.aspx?articleID = 178 Hi, You can get the value of the column at server side irrespective of its visiblity. . . yon can use normally as Gridview1.Rows[0].Cells[cellN0].Text; suppose you want to get the invisble column value at client side, you cannot. . . because when the control visible property is set to
Hi all, I have a dilema, I need to make a column invisible in a Gridview when a certain item is selected in a dropdownlist make it visible when another item No Collected 5 So if they select - -All- - or Rejected i need to make the Column [Reason] in my Gridview visible else if the select any other status it must make the [Reason] Column InVisibe Can anyone please help. . Thanks void bind() { string item = DropDownList1.SelectedValue.ToString(); foreach ( GridViewRow
Hi, I am using LINQ data source and Gridview control for CRUD operations. But when we press the edit link and update visible columns couple of invisible column values such as status and audit columns should also get updated by the system. Can click on Edit button ? also when you click on Edit button , are you showing those invisible column and allow user / admin to update the value of those field ? It may be possible
I have 10 columns , i want only by settting their visibility (ie visible = true) and on Next button click, make first three column invisible and make other 3 columns visible. same way on previous page make first 3 columns visible and other 3 invisible. You can check the counter for only 3 columns and set them accordingly. And when Hope this helps. This is just an overview. coding is up to you. keywords: C Column Paging in Gridview description: Column Paging in Gridview I have 10 columns , i want only 3 to be displayed a
NET 06-Jun-13 10:16 AM Hi All, I want to make the datagrid column invisible if that column is empty. regards, Arman Hi Arman, try to use this dgDataGrid.Columns(3).visible = false here 3 is the index number of your column, column index will always start from 0 (Zero) Hope this will help you If ur app is windows app. set the column width to zero to hide a column provided you have a non-Nothing tablestyle. '. . . . make sure your DataGrid is using a tablestyle dgts As New DataGridTableStyle() dgts.MappingName = "customers" dataGrid1.TableStyles.Add(dgts) '. . . . . . 'method to set a column with by colnumber Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As Integer, width As Integer
hi all i want to make the first column in datagrid to be set to say ProductID. but i dont want it to be visible. i have generated all other columns with code(autogenerate column is set to false) how can i do this? also i want the value of that invisible first column to be used as parameter to a function can anyone please help me thanks > > but i dont want it to be visible. << To make the first column invisible, simply set the Visible property of the column to false: DataGrid1.Columns[0].Visible = false
i want a hyperlink to be appered in a column of gridview and if i click on that hyperlink it shud display the total row of that particular hyperlink in a separate gridview check this for creating a hyperlink column and after doing this, you can write the logic to display the number and other stuff in the respective page. . <asp:GridView ID = "GridView1" runat = "server" BackColor = "White" BorderColor = "White" BorderStyle = "Ridge" BorderWidth = "2px" CellPadding = "3" CellSpacing SmallWindow.aspx?id = {0}" DataTextField = "CategoryName" NavigateUrl = "SmallWindow.aspx" / > <asp:BoundField DataField = "Description" / > < / Columns> < / asp:GridView> Nice put update panel with in gridview and when u click hyperlink update hyperlink text value by the roo count in datasource