Click here to Skip to main content
15,912,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one div as following

<div>
  <% # IIF(DataBinder.Eval (Container.DataItem,"Specifiction2").ToString()<> "","")
<div>

I want to hide above div when "spcefication2" is blank on .aspx page

how to do it??

What I have tried:

I tried many things but not succeed
Posted
Updated 25-Jun-20 7:34am
Comments
F-ES Sitecore 20-Jun-20 8:24am    
Hide it using css, or omit the div from the html completely?
Akshay malvankar 20-Jun-20 9:59am    
how that whats I asking , I want to hide and show depending upon the condition
Maciej Los 22-Jun-20 4:53am    
"I tried many things but not succeed " - what exactly?
Show your code!

If you want to enable user to show/hide div on client machine, you have to use Javascript. See: Hide and Show DIV using JavaScript[^]

If you want to show/hide div depending on date retrieved from server, please see:
Show/hide elements dynamically in web page[^]
asp.net - How to hide a div from code (c#) - Stack Overflow[^]
 
Share this answer
 
The simplest option would be to use a Panel control:
ASPX
<asp:Panel runat="server" visible='<%# Not String.IsNullOrEmpty(Eval("Specification2", "{0}")) %>'>
    ...
</asp:Panel>
Panel Class (System.Web.UI.WebControls) | Microsoft Docs[^]
 
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