MayoorPatel
Programmer
Hi there guys I am getting the follwing error when I run my page.
System.NullReferenceException: Object reference not set to an instance of an object.
at DCA.TribunalsService.Lands.Web.Search.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
have hacked around all day to no avail, can anyone help or see the prblem?
Any help as always appreciated.
Mayoor
System.NullReferenceException: Object reference not set to an instance of an object.
at DCA.TribunalsService.Lands.Web.Search.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PagerControl.PageSize = Configuration.GetInt("DCA.TribunalsService.Lands.Web.Search.Grid.PageSize")
Page.RegisterClientScriptBlock("dropdowns", Me.ClientSideScript)
Utility.PopulateCommissioners(drpCommissioner, 0)
If Not IsPostBack Then
Utility.PopulateCategory(drpCategory)
PagerControl.PageIndex = 1
End If
If IsPostBack Then
If Not Request.UrlReferrer.AbsolutePath.IndexOf("view.aspx") = -1 Then
' have come back from view page
Utility.PopulateCategory(drpCategory)
' sets the page index what it was before the search
PagerControl.PageIndex = Request.QueryString("PagerControl_PageIndex")
' sets the category dropdown to what it was before
If Not Request("drpCategory").Equals(String.Empty) Then
drpCategory.Items.FindByValue(Request.QueryString("drpCategory")).Selected = True
End If
End If
' if the category value was not "--choose a category" then we need to populate subcategory
' with the corresponding value
If Not drpCategory.SelectedItem.Value = -1 Then
Utility.PopulateSubCategory(drpSubcategory, drpCategory.SelectedItem.Value)
' if the subcategory was not empty the set the selected value to that of what it was before
If Not Request("drpSubcategory").Equals(String.Empty) Then
drpSubcategory.Items.FindByValue(Request("drpSubcategory").ToString).Selected = True
End If
End If
' if the commissioner dropdown was not empty then set that to what it was before
If Not Request("drpCommissioner").Equals(String.Empty) Then
drpCommissioner.Items.FindByValue(Request("drpCommissioner").ToString).Selected = True
End If
End If
drpCategory.Attributes.Add("onchange", "populate(this, 'Form1', 'drpSubcategory', this.selectedIndex);")
btnSearch.Attributes.Add("onclick", "document.forms[0].action = ""default.aspx""")
End Sub
have hacked around all day to no avail, can anyone help or see the prblem?
Any help as always appreciated.
Mayoor