Hid\show group box in asp.net

Joined
Jan 13, 2023
Messages
10
Reaction score
1
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
 
Joined
Jan 30, 2023
Messages
107
Reaction score
13
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
 
Joined
Sep 4, 2022
Messages
136
Reaction score
16
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

Members online

No members online now.

Forum statistics

Threads
474,053
Messages
2,570,431
Members
47,075
Latest member
TysonV438

Latest Threads

Top