Ritesh Aggarwal
Ritesh Aggarwal

Reputation: 1

Use variable in src in asp.net

I am creating a table and then in every row of table I need to put different image depending on the results retrieved from the database.

ImageVariable=Image1.jpg

<"Table>
    <"TR> 
    <"TD>
        <"IMG SRC=<%=ImageVariable %>> 
    <"/td>
    <"/tr>
<"/table>

However, when I view the results, this image variable is not converted to the actual value but is considered as value itself, so my image link becomes htt://Ritesh/Imagevariable

Instead what I want is htt://Ritesh/Image1.jpg

Please assist.

Upvotes: 0

Views: 1374

Answers (1)

Jalpesh Vadgama
Jalpesh Vadgama

Reputation: 14216

Do some thing like this.

public static string ImageVariable="Image1.jpg"

then write in <%=%> block

Upvotes: 1

Related Questions