Solved

show image from db in stylesheet

Posted on 2011-09-09
4
243 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
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

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

Author Comment

by:tjgrindsted
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now