Controls the display style of a panel.

Source: Internet
Author: User

"I want to change the display attribute in the style of the Panel to none in the onload method. Because my page has some scripts, I want to display this Panel after triggering some events. I don't want to use panel3.visible = false ;"

// The onload method of the page. The values sent from the previous page are used to determine which panels are displayed and which are not displayed if (request. querystring ["Index"]! = NULL) {If (request. querystring ["Index"]. tostring (). equals ("2") {panel1.visible = false; panel2.visible = true;} else if (request. querystring ["Index"]. tostring (). equals ("3") {// display = "NONE"; I want to set the display of the Panel to none panel3.visible = true;} else if (request. querystring ["Index"]. tostring (). equals ("4") {panel1.visible = false; panel4.visible = true ;}}

"On my page
Style = "display: none;" is added to the Panel ;"
When loading a page, you can use the index value sent from other pages to display some panels and some do not.
You can also use js to achieve the effect"

HTML markup:

<Asp: Panel id = "Panel1" style = "width: 100%;" runat = "server"> Asda </ASP: Panel> <asp: panel id = "panel2" style = "width: 100%; display: none;" runat = "server"> Asda </ASP: Panel> <asp: panel id = "panel3" style = "width: 100%; display: none;" runat = "server"> Asda </ASP: Panel>

Bytes ------------------------------------------------------------------------------------------------------------------------------

The separation line is a question asked by netizens. The following is a demonstration by insus. net.
For better results, insus. NET added some supplementary code, such as HTML markup changed:

CS code:

In real-time operation demonstration, when a Web page starts to browse, Panel1 is displayed by default. Others are not displayed. When the relevant index is input, the relevant display is displayed. If no matching index is found, will not be displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.