user1192078
user1192078

Reputation: 41

Passing url to Image tag in asp.net C#

I dont know how to pass value from page.aspx.cs (string url = dr["report_image"].ToString();) to page.aspx ( )

i save image filename (eg:sunset.jpg) to sql database and retrieve it using reader (string url = dr["report_image"].ToString();) and i want to use this url (or filename) to use in the main webpage (aspx). I dont know how to pass this value from ".aspx.cs" to ".aspx"

Any help would be appreciated. thank you

Upvotes: 0

Views: 1466

Answers (2)

brtb
brtb

Reputation: 2311

or you can simply generate Image element in aspx.cs side.

the code below

 Image img = new Image();
 img.ImageUrl = "your string";

Upvotes: -1

Bob  Sponge
Bob Sponge

Reputation: 4738

<asp:Image ID="img" Runat="Server" />

Аnd in the code:

img.ImageUrl = url

Upvotes: 2

Related Questions