How to get value of variable in Aspx to ascx page

Posted on 2009-12-21
Last Modified: 2012-05-08
In my aspx page, in page_load I get store a variable using ....
Dim sdid = Server.UrlDecode(Request.QueryString("dID").ToString())

I need to get this value into my web user control. (ascx).
How would I get it? I use
Question by:zachvaldez
    LVL 51

    Assisted Solution

    in your ascx code behind add a property, say sdid (see code below)

    then use this

    Dim sdid = Server.UrlDecode(Request.QueryString("dID").ToString())
    myAscx.sdid = sdid
    Private _sdid As String
    Property sdid() As String
    		Return _sdid
    	End Get
    	Set(ByVal value As string)
    		_sdid = value
    	End Set
    End Property

    Open in new window


    Author Comment

    I get the value of the variable from another aspx page..(ex. Enroll.aspx)
    I would like to ahve variable be outputed in a variable or label in the web user control(ascx)

    Dim sdid = Server.UrlDecode(Request.QueryString("dID").ToString())
    LVL 51

    Accepted Solution

    try this

    usercontrol.FindControl("somelabelid").Text = sdid

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now