Hid\show group box in asp.net


Joined
Jan 13, 2023
Messages
4
Reaction score
0
Hi,
I want to show & Hide group box according to certain condition:
ASP.net:
<div id="MyDiv" runat="server" visible="true" style="margin-top: 10px; margin-bottom: 10px;">
<asp:Panel runat="server" ID="pnlTest" GroupingText="My Group">

Then in code behind do this:
If true
MyDiv.visible := true
else
myDiv.visible := false;

Is this the best way to achieve that ?
Thank you
 
Ad

Advertisements

Joined
Jan 30, 2023
Messages
108
Reaction score
8
Hi,
I want to show & Hide group box according to certain condition:
ASP.net:
<div id="MyDiv" runat="server" visible="true" style="margin-top: 10px; margin-bottom: 10px;">
<asp:Panel runat="server" ID="pnlTest" GroupingText="My Group">

Then in code behind do this:
If true
MyDiv.visible := true
else
myDiv.visible := false;

Is this the best way to achieve that ?
Thank you
Yes, setting the Visible property of the div element to true or false is one way to show or hide the group box in ASP.NET. This method can be used to dynamically control the visibility of the group box based on a certain condition. However, there may be other methods to achieve the same result, such as using JavaScript or CSS to hide and show elements based on the condition
 
Ad

Advertisements

Joined
Sep 4, 2022
Messages
25
Reaction score
0
if you use Javascript with 'visibility', you act on 'opacity' .

the element will stay at the same place, with all possible interactions ON.

By javascript, the best way to make an element out of the page stream is by css 'display:none;'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top