Accessing Web User Control Values From ASPX Code Behind

J

Jason

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top