What I have tried:
<tbody id="divcomp" runat="server">
<asp:ListView ID="ddlcomputers" runat="server" DataKeyNames="Cid" OnItemCommand="ddlcomputers_ItemCommand" OnItemDeleted="ddlcomputers_ItemDeleted"><asp:Label ID="lblComputerNamee" runat="server" Text='<%#Eval("ComputerName") %>'> <img class="md-trigger" data-modal='<%#Eval("ComputerName") %>' align="absmiddle" src="../html/images/info.png" runat="server" width="24" height="24" alt="" /> <asp:Label ID="lblCid" runat="server" Text='<%#Eval("Cid") %>' Visible="false"> <asp:ListView ID="ListView1" runat="server">
Computer Details
Computer Name :
<%#Eval("ComputerName") %>
IP Address :
<%#Eval("IPAddress") %>
Computer Type :
<%#Eval("ComputerType") %>
Department :
<%#Eval("Department") %>
Smps :
<%#Eval("Cpu") %>
Processor :
<%#Eval("Processor") %>
Ram :
<%#Eval("Ram") %>
Board :
<%#Eval("Board") %>
HardDisk :
<%#Eval("HardDisk") %>
Mouse :
<%#Eval("Mouse") %>
KeyBoard :
<%#Eval("Keyboard") %>
Monitor :
<%#Eval("Monitor") %>
Status:
<%#Eval("Status") %>
Date:
<%#Eval("Date") %>
WhoBrought :
<%#Eval("WhoBrought") %>
WhoAdded :
<%#Eval("WhoAdded") %>
<button class="md-close"></button><%#Eval("ComputerType") %> <asp:ImageButton ID="imgedit" runat="server" ImageUrl="~/html/images/edit.png" Width="24" CommandName="Edit" Height="24" alt="" /> <asp:ImageButton ID="imgrepair" runat="server" ImageUrl="~/html/images/repair.png" Width="24" Height="24" CommandName="Repair" alt="" /> <asp:ImageButton ID="imgdel" runat="server" ImageUrl="~/@@@html/images/Dead.jpg" Width="24" Height="24" alt="" CommandName="Dead" OnClientClick="return confirm('Do you want to Dead this Computer?');" /> <td runat="server" visible="false"> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/html/images/delete.png" Width="24" Height="24" alt="" CommandName="Delete" OnClientClick="return confirm('Do you want to delete this Computer?');" /> <asp:Label ID="LblOther" runat="server" Text='<%#Eval("Status") %>'>
Aryan Kumar
03-Jul-2023Sure, here are the steps on how to hide a particular label in a nested ListView in ASP.NET MVC:
OnItemDataBound
event of the outer ListView, get the nested ListView and the label you want to hide.Visible
property of the label tofalse
.Here is an example of the code:
C#
This code will hide the label with the ID
1
in the nested ListView when it is bound to data. You can change the ID of the label to hide by changing the value of the_labelIDToHide
variable in the code-behind file.