Dofactory.com
Dofactory.com
 Back to list
Views:   2.7K
Replies:  0
Archived

Object reference not set to an instance of an object.

Hello,

I'm trying to replicate the situation you have in the Webforms app, where you first are presented with a list (of members) and from the list select an individual record.

So far, I have completed the first part but am having problems with the part where an individual record is selected from the list. I get the above error on the following line:

  NiftyID = Integer.Parse(Page.RouteData.Values("NiftyID").ToString())

I'm not sure what the error message is trying to tell me or what it is I'm doing wrong. I'm also not sure what role the Web.Sitemap plays in navigation between forms (if any).

I've appended the the particular sub that's causing the problem below. Can you provide some clarification please?

Ed:

I'm no longer getting the 404 error, so at least I think I'm now navigating to the right page, but the original message (above) is still there and I have no idea what is causing the error. Is there any help on this please?




Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            Page.Title = "Member Details"
            Page.MetaKeywords = "Member Details, Patterns in Action"
            Page.MetaDescription = "Member Details at Patterns in Action"

            If Not IsPostBack Then
                ' sets the selected menu item in the Master page

                SelectedMenu = "members"

                NiftyID = Integer.Parse(Page.RouteData.Values("NiftyID").ToString())

                ' set DetailsView control in Add or Edit mode

                If NiftyID = 0 Then
                    DetailsViewPerson.ChangeMode(DetailsViewMode.Insert)
                Else
                    DetailsViewPerson.ChangeMode(DetailsViewMode.Edit)
                End If

                ' if no image is available display silhouette

            End If
        End Sub

 
MAI Joomun, Mar 17, 2015
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.