• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

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.
0
tjgrindsted
Asked:
tjgrindsted
  • 2
  • 2
1 Solution
 
ivan_vaguninCommented:
Hi!
I guess just like this:
background: url(/showImage.ashx?autoId=3) 0 0 no-repeat;
0
 
tjgrindstedAuthor Commented:
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" !?
0
 
ivan_vaguninCommented:
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/>") : ""';
0
 
tjgrindstedAuthor Commented:
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.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now