Reputation: 317
We're working on a big project and we're stuck a bit here.
I need to access the <img>
's from an .ASPX from the code-behind on the PageLoad()
to assign the right image (attrib src) depending on the value we just collected from the DB from an SQL Query.
We can't use the runat="server"
attribute to see it server side because we got a bunch of jQuery using the img name tag to work with.
I'm sure there's a way to access and modify the src
attribute of the images from the code behind view?
Upvotes: 2
Views: 3221
Reputation: 21112
To set the src
attribute you will have to re-render the control or manipulate by emitting JavaScript
.
Upvotes: 0
Reputation: 39898
You can use the ClientIdMode=Static
property on your image tag. That way you can add the runat=server attribute and you can still access the image tag from your jquery.
Check the following documentation for more info.
Upvotes: 1