Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a panel 1

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
I am trying to display a panel without going back to the server to do it. (If this isn't the best way, please advise). The panel only consists of a vertical list of command buttons.

The code is:
Code:
	function funMainMenuClick(obj) {
	   
       var sPanel = '';
       
       switch (obj.name) {
         case 'btnMaintenance':
           sPanel = 'panMaintenance';
           break;
         // add more case statements...
         default:
           alert('This function is not available yet.')
            break;
       }
       
       alert('Panel Name: ' + sPanel);   // debug...

       var oPanel = window.document.getElementById(sPanel);
       // The error occurs in the above statement.
       // Object required.
       
       
       alert('Panel is: ' + oPanel.name); // debug...
       
       //oPanel.style.display=('block');
       // I'm trying to get to this statement to display the panel.
       
	}

Can someone inform me as to how to do this correctly, either a better way to show a panel or how to set the "display" property of a panel on the client side.
 
This could be one of a number of things. If you have your panels visibility set to false on the server it will not even be sent to the client and hence the object doesnt exist on the client.

If this isnt the case it may because your panel has a slightly different id on the client than the server. Have you viewed the source? If the panel is in a user control for example then .NET will give it the client id of

usercontrolid_controlid not just controlid

Also beware trying to do this that the panel outputs a table as the html for the client. this may not work as well when trying to chow and hide on the client as a div in some browsers.

As an aside It annoys me somewhat that thepanel is a tabel and not a div. I have been thinking of trying to override the control and replace the HTML with div tags. Anyone tried this or know how to any pointers would be great cheers ;-)

Rob

 
>>>If you have your panels visibility set to false on the server it will not even be sent to the client<<<

Rob, many thanks. I had not read this anywhere.

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top