.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Hide GridView column

Posted By: Ramesh     Posted Date: May 28, 2010    Points:2   Category :ASP.Net
I have a GridView that I want to hide a whole column based on a condition known before it is Databound. Is the best place to do this in RowDatabound or in PreRender or ?

Regards
Ramesh

Responses
Author: Sunil Yadav       [Moderator]   Accepted Answer   
Posted Date: May 28, 2010     Points: 10   

Hi,

you can use following line of code.

GridView1.Columns[1].Visible = false;


The best way would be adding it on pre-render event from the performance point of view.Since you can hiding column befor databound so row databound is out of question.But i doubt since you are hiding column before databound no columns will e visible to you.

Author: Lalij Mer             
Posted Date: May 28, 2010     Points: 5   

Try this link

http://www.beansoftware.com/asp.net-tutorials/gridview-hidden-column.aspx

Please Check my answer if you help....
Thank You...

Lalit.
Author: BangaruBabuPureti             
Posted Date: May 31, 2010     Points: 5   

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ e.Row.Cells[0].Visible = false; }


BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend