Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All.
I have asp.net listview and i have items in this:

C#
     <asp:ListView ID="ListView1" ... ItemType="Base.Models.Doc" runat="server"  >
   ...
<ItemTemplate >
            <tr>
<td><%# Item.F1 %></td>
         <td><%# Item.F2 %></td>
         <td><%# Item.F3 %></td>
        <td><%# Item.F4  %></td>
         <td><%# Item.Tab %></td>
         <td><%# Item.Bom %></td>
   <td id="THIS" ><%#  Item.Status %></td>
     </ItemTemplate>


I want to output last "td id="THIS"" only if Item.Status exist (if column in my database with name "Status" exist . How can i make this? In codebehind or in html .

What I have tried:

Try - catch , try to make it visible=false in codebehind . Try to add this td dynamically .
Posted
Updated 6-Jun-16 12:05pm
v3

The below mentioned logic you can use after checking your item is present in the table or not.
checking of item- you can do via jquery ajax call.

Logic is explained in the below URL.They are adding when add button is clicked.In your case it will be when the condition satisfies after a db call.


[^]

Do let me know in case any queries or if you think we can modify the solution.
 
Share this answer
 
Comments
Андрей Голубцов 9-Jun-16 11:34am    
javascript is good. But i need to acess it programmatically frome codebehind (
$("#header ul").append('<li><a href="/user/messages"><span class="tab">Message Center</span></a></li>');
 
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