Accessing Web User Control Values From ASPX Code Behind

Discussion in 'ASP .Net Web Controls' started by Jason, Oct 6, 2005.

  1. Jason

    Jason Guest

    Does anyone know how to do this?

    cntHeader is my control.

    When I try to set the value of lblDistributor = label1.text, I get the
    following error.

    Object reference not set to an instance of an object

    PLEASE HELP!

    Here is my current code:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    Dim strSQL As String

    Dim rs As ADODB.Recordset

    Dim rsUser As ADODB.Recordset

    Dim cntHeader As headerinfo

    strSQL = "EXEC mf_Partners.dbo.spTblDistributors_Select_ByDistributorID " &
    Session("DistID") & ""

    rs = Global.ReturnRS(strSQL)

    strSQL = "EXEC mf_Partners.dbo.spTblDistributorsContacts_Select " &
    Session("DistID") & ", '" & Session("UserID") & "'"

    rsUser = Global.ReturnRS(strSQL)

    If Not rs.EOF Then

    HEditProfile.NavigateUrl = "acct_edit.aspx?Email=" & Session("UserID") & ""

    HOrderMaterial.NavigateUrl =
    "http://www.jacksongroup.com/modernfold/WebLogin.asp?GRP=" & _

    Trim$(rs("MaterialCode").Value & "") & "&DST=" & Session("DistID") & _

    "&FNAME=" & Trim$(rsUser("UserFName").Value & "") & "&LNAME=" &
    Trim$(rsUser("UserLName").Value & "") & _

    "&ADDR=" & Trim$(rs("Address1").Value & "") & "&CITY=" &
    Trim$(rs("City").Value & "") & _

    "&ZIP=" & Trim$(rs("ZipCode").Value & "") & "&PHONE=" &
    Trim$(rs("Phone").Value & "") & "&EMAIL=" & _

    Session("UserID") & ""



    End If

    rs.Close()

    rs = Nothing

    rsUser.Close()

    rsUser = Nothing

    Label1.Text = cntHeader.lblDistributorName.Text



    End Sub
    Jason, Oct 6, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerald
    Replies:
    1
    Views:
    571
    Chris R. Timmons
    Jul 4, 2003
  2. Gene
    Replies:
    7
    Views:
    1,893
    Matt Berther
    Apr 19, 2004
  3. Paolo Pignatelli
    Replies:
    6
    Views:
    2,166
    Paolo Pignatelli
    Feb 21, 2005
  4. TB
    Replies:
    3
    Views:
    2,097
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=
    Jul 12, 2007
  5. Michael Morse

    Accessing Web User Control from code behind

    Michael Morse, Jan 23, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    111
    Michael Morse
    Jan 23, 2004
Loading...

Share This Page