I have tried this
login_div.Style("display") = "none";
But it's not working.how can I set the display of the div to none through code behind, in aspx I have a div:
<div id="login_div" runat="server">
I have tried this
login_div.Style("display") = "none";
But it's not working.how can I set the display of the div to none through code behind, in aspx I have a div:
<div id="login_div" runat="server">
I believe this should work:
login_div.Attributes.Add("style","display:none");
Try if this works:
Panel2.Style.Add("display", "none");
try this
<div id="login_div" runat="server">
and on the code behind.
login_div.Style.Add("display", "none");
if(displayit){
login_div.Style["display"]="inline"; //the default display mode
}else{
login_div.Style["display"]="none";
}
Adding this code into Page_Load
should work. (if doing it at Page_Init you'll have to contend with viewstate changing what you put in it)
Since this is a login div, shouldn't the default be to NOT display it. I am going to go ahead and assume then you want to display it then via javascript.
<div id="login" style="display:none;">Content</div>
Then using jQuery:
<script type="javascript">$('#login').show();</script>
Another method you might consider is something like this:
<div id="login" style="display:<%=SetDisplay() %>">Content</div>
And the SetDisplay() method output "none" or "block"
div_id.Attributes.Add("style","display:none");
div_id: id which you want to hide.
Attributes: that will use value.
Add: keyword will add the attribute.
Style: is the attribute.
and last one is the name and value of the attribute
© 2022 - 2024 — McMap. All rights reserved.
display: none;
then it won't display. I don't understand what your asking. – Sacttler