Reference a variable in class code behind ASPX with the vb source code

Hi All

I am trying to retrieve an ID number being passed from another aspx page and place that value within an image url in order to retrieve the respective images. I have declared a variable within the class code as follows:

the url I am trying to retrieve theid from look like this:


the variable declaration looks like this:

    Public Property PropertyID() As String
            Return CType(ViewState("propertyid"), String)
        End Get
        Set(ByVal value As String)
            ViewState("propertyid") = value
        End Set
    End Property

    Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) _
            Handles Me.Init
        Me.PropertyID = Request.QueryString("PID")
    End Sub


and the img src currently looks like this:

<asp:Image ID="Image1" runat="server" Height="270px" Width="410px" ImageUrl="image2.aspx?CID=0&PID="


i need to be able to reference that id and place it within the image url

Thanks for your help

I am using visual studio aspx. thanks
Who is Participating?
laotzi2000Connect With a Mentor Commented:
In your Page_Load,

Image1.ImageUrl = "image2.aspx?CID=0&PID=" & PropertyID
acancelAuthor Commented:
This may be a dumb question, but where Page_Load...sorry, am new to ASP
It's the event handler when your page loads. It's in the code behind.

Double click on your page and you will go to it.
acancelAuthor Commented:
never mind, figured it this stuff is absolutely awesome...thanks for the help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.