Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can set list view columns visible property to false in web applications using c# dynamically. Please help me.
Posted
Updated 17-Aug-11 22:16pm
v2
Comments
Suresh Suthar 18-Aug-11 4:17am    
If its that much urgent then do it yourself..
And please post your code where you stuck.
BTW you can set Visible property to False at runtime in C#.
Shibiny 18-Aug-11 4:29am    
Label ll = (Label)e.Item.FindControl("lblsample");
ll.Visible = false;
this not working.
Shibiny 18-Aug-11 4:28am    
Label ll = (Label)e.Item.FindControl("lblsample");
ll.Visible = false; this not working
Herman<T>.Instance 18-Aug-11 4:34am    
with what error?
Shibiny 18-Aug-11 4:44am    
Label ll = (Label)e.Item.FindControl("lblsample"); ll.Visible = false; logically the label will be disabled.after executing these code the label again visible.

Try to make Cell's visibility false.
For this first find the row with the help of FindControl method.

C#
HtmlTableRow htrRow = e.Item.FindControl("rowId");
if(htrRow != null)
{
htrRow.Cells[0].Visible = false;
}


Provide an ID to the tr in the ListView as I have given "rowId" for the rows in the ItemTemplates,

ASP.NET
<table><tbody><tr id="rowId" runat="server">
</tr></tbody></table>
 
Share this answer
 
Looks like you should just be able to bind the label's Visible property with Eval("thiscolumnvisible") in the ItemTemplate. Alternatively, put a client side id on the items in that column and use Javascript to show/hide them all.
 
Share this answer
 
You could always change the column's width to 0.
 
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