How to get value of variable in Aspx to ascx page

Posted on 2009-12-21
Medium Priority
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 vb.net
Question by:zachvaldez
  • 2
LVL 61

Assisted Solution

HainKurt earned 1000 total points
ID: 26099952
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

ID: 26100148
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 61

Accepted Solution

HainKurt earned 1000 total points
ID: 26100166
try this

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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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