Link to home
Start Free TrialLog in
Avatar of tjgrindsted
tjgrindsted

asked on

show image from db in stylesheet

Hi.
I have a db with some image and i can see the images with this line of code.
<asp:Image ID="Image1" runat="server" ImageUrl="showImage.ashx?autoId=3"/>

that works, but now i have this code on my main site in a <style></style>
}
.ie7 #featured-v1,
.ie8 #featured-v1 {
      background: url(add/img/married.png) 0 0 no-repeat;
}
.ie7 #featured-v2,
.ie8 #featured-v2 {
      background: url(add/img/children.png) 0 0 no-repeat;
}
.ie7 #featured-v3,
.ie8 #featured-v3 {
      background: url(add/img/group.png) 0 0 no-repeat;
}
.ie7 #featured-v4,
.ie8 #featured-v4 {
      background: url(add/img/student.png) 0 0 no-repeat;
}

How can i changes the stylesheet code to use
showImage.ashx?autoId=3   and not     add/img/student.png
so it will use the image from the db in the stylesheet code and not the image from the folder.
ASKER CERTIFIED SOLUTION
Avatar of Member_6283346
Member_6283346

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjgrindsted
tjgrindsted

ASKER

is that all..he he THX

Maybe u can help me wit this little thing then..
I have this little code
<asp:TextBox ID="txt_imgMainTitle" TextMode="multiline" runat="server"></asp:TextBox>
When i use ENTER it make a line jump, when i then save the text to my DB with this code:
cmd.Parameters.Add("@img_maintitle", OleDbType.VarChar).Value = txt_imgMainTitle.Text
and i see the text in live view the text is without <br /> for the Enter Jump, how do i add this <br /> to the text saved in the DB if i use Enter Jump in the TextBox TextMode="multiline" !?
Hi!
New lines are not encoded like \r\n in text box (not <br/>), so try following:
cmd.Parameters.Add("@img_maintitle", OleDbType.VarChar).Value = txt_imgMainTitle.Text != null ?txt_imgMainTitle.Text.Replace("\r\n", "<br/>") : ""';
I fix it with
<%# Replace(Container.DataItem("img_maintitle"), vbCrLf, "<br />")%>
bc. i can see that if i want to edit the text again then i can get some problems with the <br /> tag there.
But thx alot.