-
Hi All,
I have a web page that accepts parameter and based on the parameter value it displays the image(Image is saved in project images folder with parametername.jpg)
Now what i am doing is, i am reading that parameter from query string and assigning it to a hidden value.
then on aspx page i am reading image as
<img src = "Images/<%hidden1.value%.jpg>"
this approach works fine but the problem is
1.) the images folder needs to be outside the project images folder and it adds the whole path of local system to the http://localhost:67634/images/C:/pro...eter.jpg--this results in no image found
2.) a default image to be displayed when no image found as i am chcking the file as file.exists(parameter.jpg)
Edit:
i am assingning a dynamic value to image through hidden feild value and it is not working.
the tag is
<img src="<%hidden1.value%>" alt=""/>
this does not show any image and on checking the properties of image it says no URL defined
-
You should assign the image in the code behind file like:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("YourParameterName") IsNot Nothing Then
Image1.ImageUrl = Request.QueryString("YourParameterName")
Image1.Visible = True
Else
Image1.Visible = False
End If
End Sub
Last edited by majicmonk; 07-22-2009 at 1:56 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks