Question

I have asp:Label. How can I change visible from C# and js code?

Can have:

style="display: none;"

or

Visible="false"

If use first way, couldn't change visible from C# code,

if use second way, couldn't change visible from JS code.

I need have opportunity to change visible from C# and JS code at the same time. C#:

MyPanel.Visible = true;  

JS:

 $('.MyPanel').show();
Was it helpful?

Solution

You could set its style attributes using C# and then use js to change it back

MyPanel.Attributes.Add("style","display:none");

Then on the client side you can call what you declared already.

$('.Mypanel').show(); // i'm assuing you've add a class on the 'MyPanel' element.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top