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

Posted on 2006-05-16
Last Modified: 2008-02-20
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
Question by:acancel
    LVL 12

    Accepted Solution

    In your Page_Load,

    Image1.ImageUrl = "image2.aspx?CID=0&PID=" & PropertyID

    Author Comment

    This may be a dumb question, but where Page_Load...sorry, am new to ASP
    LVL 12

    Expert Comment

    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.

    Author Comment

    never mind, figured it this stuff is absolutely awesome...thanks for the help

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    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…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    This video discusses moving either the default database or any database to a new volume.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 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

    22 Experts available now in Live!

    Get 1:1 Help Now