DrivenTooFar
Posts: 10
|
| Posted: 10/23/2007, 12:29 PM |
|
I have a button that is of type image that gets it's image from the src property. What I want to do is, depending on the query string, dynamically change this property. I would imagine that this property is a string but I can't figure out how to pass it a variable. It only seems that you have to hard code one path. Is this true or is there a way to dynamically alter it? Thanks.
|
 |
 |
mrachow
Posts: 509
|
| Posted: 10/24/2007, 12:04 AM |
|
I recommend looking in Examples and Techniques manual subsection Other (around page 92).
The examples there should give you an idea what to do.
If the direct way setting the image link as an attribute of the image control shouldn't be possible using an component attribute should always do.
_________________
Best regards,
Michael |
 |
 |
DrivenTooFar
Posts: 10
|
| Posted: 10/24/2007, 8:42 AM |
|
Thank you mrachow for your response. If anyone is interested, this is how I accomplished it.
For the button, I added an attribute. The name is "img", the source type is "Expression" and I left the Source Name blank. In the HTML, I replaced the src property with the attribute, which look like src="{button:img}".
The next step was to add a Before Show on the button. I used a querystring in order to decide which image to show. Here is what the code looks like in VB:
If Request.QueryString("mystring") Then
Sender.Attributes("img") = "MyImage.gif"
Else
Sender.Attributes("img") = "OtherImage.gif"
End If
That is it and I hope that this can help anyone in the future. Thanks!
|
 |
 |
|