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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with panels and visibility

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I am tring to setup a multipage form look. I am getting the following error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 40: strPanelName = "pnlForm" & ViewState( "CurrentPage")
Line 41: pnlPanel = FindControl( strPanelName )
Line 42: pnlPanel.Visible = false
Line 43: 'Show Current Panel
Line 44: ViewState( "CurrentPage" ) += 1

Here is the sub.

Sub btnSection1_click( s As Object, e As EventArgs )
Dim pnlPanel as Panel
Dim strPanelName as String
'hide previous panel
strPanelName = "pnlForm" & ViewState( "CurrentPage")
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = false
'Show Current Panel
ViewState( "CurrentPage" ) += 1
strPanelName = "pnlForm" & ViewState( "CurrentPage")
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = True
End Sub

Any help would be great!
 
Nevermind. It always helps if you have the runat="server" in your panels. Thanks anyways
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top