Hi all,
I have a control were I dynamically add child controls, ascx pages, to a placeholder based on a menu selection. I finally have the controls working properly but my child controls contain submit and cancel linkbuttons. All the events fire fine but my response.redirect throws a "Object reference not set to an instance of an object" error. I use the same redirect statement in the main control and everything works fine so I know it works. I need this to work to redirect back to a main control. I have included to code below for the main control and the child control.
Thanks....
----------------------------------This is the entire error--------------------------------------
InnerException: System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Exceptions.ProcessModuleLoadException(PortalModuleControl ctrlModule, Exception exc)
at LCGI.DNN.Modules.PTT.Company_Settings.cmdCancel_Click(Object sender, EventArgs e)
in C:\Virtual Directories\2.2\DesktopModules\PTT\Controls\Company_Settings.ascx.vb:line 179 at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain()
-----------------------------------------Main Control-------------------------------------------
Private Sub ctlDashboard_MenuClick(ByVal ID As String) Handles ctlDashboard.MenuClick
_MenuID = Convert.ToInt32(ID)
Session("MenuID") = _MenuID
_MenuClick = 1
LoadPTTControl()
End Sub
Sub LoadPTTControl()
Dim controlName As String = "Main.ascx"
If _MenuClick = 1 Then
Response.Redirect(NavigateURL(), True)
End If
Select Case _MenuID
Case 1
controlName = "Main.ascx"
Case 50
controlName = "Company_Settings.ascx"
End Select
contentControl = Page.LoadControl(("~/DesktopModules/PTT/Controls/" & controlName))
plhContent.Controls.Clear()
plhContent.Controls.Add(contentControl)
contentControl.ID = "ctlContent"
End Sub 'LoadTab
-----------------------------------------Child Control-------------------------------------------
Private Sub cmdCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancel.Click
Try
Session("MenuID") = 1
Response.Redirect(NavigateURL(), True)
Catch exc As Exception
ProcessModuleLoadException(Me, exc)
End Try
End Sub