Solved

show image from db in stylesheet

Posted on 2011-09-09
4
249 Views
Last Modified: 2012-05-12
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
Comment
Question by:tjgrindsted
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
ivan_vagunin earned 200 total points
ID: 36513198
Hi!
I guess just like this:
background: url(/showImage.ashx?autoId=3) 0 0 no-repeat;
0
 

Author Comment

by:tjgrindsted
ID: 36515976
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
 
LVL 18

Expert Comment

by:ivan_vagunin
ID: 36516408
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
 

Author Comment

by:tjgrindsted
ID: 36518684
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question