Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to hide the column when it is empty.


I don't want to display the particular records in gridview... when the column is empty in database.

do not show that record in gridview if that particular record column is empty.



please give me a good solution

thanks in advance.
Posted

use this code
C#
gridview.columns["columnname"].visible = false;
 
Share this answer
 
Comments
Ranjith Reddy CSE 16-Apr-13 3:51am    
sorry, not working
PRAKASH9 16-Apr-13 3:56am    
please put your code.what's the error is generated?
Ranjith Reddy CSE 16-Apr-13 4:26am    
This is my code

GVRecords.Columns["Fees"].Visible = false;

This is the ERROR

The best overloaded method match for 'System.Web.UI.WebControls.DataControlFieldCollection.this[int]' has some invalid arguments

Please give me a good solution.

Thanks
Ranjith Reddy CSE 16-Apr-13 4:27am    
I wrote this code in Row databound
Ranjith Reddy CSE 16-Apr-13 4:27am    
Fees is name of column
C#
protected void grdresult_RowCreated(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[2].Visible = false; 
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900