"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") {// panel1.style. 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.