By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,220 Members | 1,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,220 IT Pros & Developers. It's quick & easy.

Hiding a column in the listview control

100+
P: 111
Hi All,
I am using a listview control in my usercontrol so that it can be used in more than one form. This user control has one column extraw, so i want to make it invisible depending on the form it is being used.
I am using table in the listview control for formating purpose. In this table I want to hide a column. Is it posible to hide the column?. I am facing the problem because I cant catch the row its showing null values.

Code goes like this:
<LayoutTemplate>
<div style="height:222px; border: solid 1px #7f7f7f;border-collapse:collapse;">
<table id="ManageContent" runat="server" class="grid" cellspacing="0" border="0">
<tr id="row" runat="server">
<th style="width:10px" runat="server" id="thImgRadio"></th>
<th style="margin:0px;margin-left:0px;width:20px" runat="server" id="thImgcheck">
<asp:CheckBox ID="chkCheckAll" runat="server" OnCheckedChanged="CheckALL" AutoPostBack="true"/>
</th>
<th style="width:130px">
<asp:Image Style="float: left" AlternateText="Click on header to sort by Name"
ID="imgSortName" runat="server" ImageUrl="~/App_Themes/iDeliverDefault/gridImg/header-sortable.PNG" />
<asp:LinkButton ID="btnSortName" runat="server" Style="color: White;" Text="Name"
CommandName="Sort" CommandArgument="report_desc" />
</th>
<th style="width:170px">
<asp:Image Style="float: left" ID="imgSortNetwork" AlternateText="Click on header to sort by Network"
runat="server" ImageUrl="~/App_Themes/iDeliverDefault/gridImg/header-sortable.PNG" />
<asp:LinkButton ID="btnSortNetwork" runat="server" Style="color: White;" Text="Network"
CommandName="Sort" CommandArgument="from_path,url_link" />
</th>
<th style="width:90px">
<asp:Image Style="float: left" ID="imgSortStatus" AlternateText="Click on header to sort by Status"
runat="server" ImageUrl="~/App_Themes/iDeliverDefault/gridImg/header-sortable.PNG" />
<asp:LinkButton ID="btnSortStatus" runat="server" Style="color: White;" Text="Status"
CommandName="Sort" CommandArgument="released" />
</th>
<th style="width:90px">
<asp:Image Style="float: left" ID="imgSortPublished" AlternateText="Click on header to sort by Published"
runat="server" ImageUrl="~/App_Themes/iDeliverDefault/gridImg/header-sortable.PNG" />
<asp:LinkButton ID="btnSortPublished" runat="server" Style="color: White;" Text="Published"
CommandName="Sort" CommandArgument="published_date" />
</th>
<th style="width:90px">
<asp:Image Style="float: left" ID="imgSortModified" AlternateText="Click on header to sort by Modified"
runat="server" ImageUrl="~/App_Themes/iDeliverDefault/gridImg/header-sortable.PNG" />
<asp:LinkButton ID="btnSortModified" runat="server" Style="color: White;" Text="Modified"
CommandName="Sort" CommandArgument="file_last_modified" />
</th>

<th visible="false"></th>

</tr>
<tr id="itemPlaceholder" runat="server" style="table-layout:fixed"/>
</table>
</div>
</LayoutTemplate>

<ItemTemplate>
<tr id="Itemrow" runat="server" class='<%# Container.DataItemIndex % 2 == 0 ? "row" : "altrow" %>'>
<td id="thImgRadio" runat="server" style="width:10px">
<asp:ImageButton ID="imgUG" runat="server" ImageUrl="~/App_Themes/TheHartford/Images/option.png"
CommandName="select" />
</td>
<td id="thImgCheck" runat="server" class="rownum" style="width:20px">
<asp:CheckBox ID="chkManageContent" runat="server"/>
</td>
<td style="width:130px">
<div style="width:130px; overflow:hidden">
<nobr>
<asp:Label ID="lblReport_Desc" runat="server" Text='<%# Eval("report_desc")%>' ToolTip='<%# Eval("report_desc")%>'></asp:Label>
</nobr>
</div>
</td>
<td style="width:170px">
<div style="width:180px; overflow:hidden">
<nobr>
<asp:Label ID="lblUrl" runat="server" Text='<%# Eval("url_link").Equals("NA") ? Eval("from_path") : Eval("url_link") %>'
ToolTip='<%# Eval("url_link").Equals("NA") ? Eval("from_path") : Eval("url_link") %>' ></asp:Label>
</nobr>
</div>
</td>
<td style="width:90px">
<ajax:ConfirmButtonExtender ID="cbeImageStatus" runat="server"
TargetControlID="imgbtnStatus" ConfirmText='<%# Eval("released").ToString()=="1"? "Are you sure you want to change the status to offline?" : "Are you sure you want to change the status to online?" %>'/>
<nobr>
<asp:ImageButton ID="imgbtnStatus" runat="server" ImageUrl='<%# Eval("released").ToString()=="1"? "../App_Themes/iDeliverDefault/Images/online.gif" : "../App_Themes/iDeliverDefault/Images/offline.gif"%>'
OnClick="imgbtnStatus_Click" CommandArgument='<%#Eval("p_d_report_url_id")%>' style="cursor:pointer" AlternateText="Click to change status."/>
<%# Eval("released").ToString()=="1"? "Online":"Offline"%></nobr>
</td>
<td style="width:90px">
<%# DateTime.Parse(Eval("published_date").ToString()). ToShortDateString()%>
</td>
<td style="width:90px">
<%# DateTime.Parse(Eval("file_last_modified").ToString ()).ToShortDateString()%>
</td>
<td visible="false">
<asp:Label ID="lblReportUrlID" Text='<%# Eval("p_d_report_url_id")%>' Visible="false" runat="server"></asp:Label>
</td>
</tr>
</ItemTemplate>

The one in the bold I want to hide according to the screen.

Thanks in advance.

Thanks & Regards
Bharath Reddy VasiReddy
Aug 21 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.