[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

asp image with border around it

Posted on 2009-04-15
5
Medium Priority
?
511 Views
Last Modified: 2013-12-17
Hi,

I have the following code

asp.net
<div class="actualImageVid">
                    <a href="ShowCommentsforVideos.aspx?Video=<%#DataBinder.Eval(Container.DataItem,"Video_ID")%>">
                        <asp:Image ID="imgStartUpImagePath" runat="server" align="left" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"StartUpImagePath")%>' />
                    </a>
                </div>

but when i run the page i find that it has the code below setting border to 0
<img id="ctl00_ContentPlaceHolder1_ListView1_ctrl0_ctl02_imgStartUpImagePath" align="left" style="border-width: 0px;" src="x.jpg"/>

which means that what i set in the css for the border property get over ridden I havenot used in line styling so how to i get rid of this border on the content placeholder

please help

Thanks,

R8VI
0
Comment
Question by:R8VI
[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
5 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 24147948
Try this solution:
http://vaultofthoughts.net/GettingRidOfASPNETImageControlBorder.aspx

I hope it will work for you.
0
 
LVL 10

Expert Comment

by:JPJ78
ID: 24147975
I'm not sure how to remove the "border-width: 0px" so that it is possible to use css, however you can set the border on the image with the properties
BorderWidth, BorderColor and BorderStyle or you can use a regular img html tag if you don't have to access the object from codebehind.

<div class="actualImageVid">
   <a href="ShowCommentsforVideos.aspx?Video=<%#DataBinder.Eval(Container.DataItem,"Video_ID")%>">
      <img style="float: left;" src='<%#DataBinder.Eval(Container.DataItem,"StartUpImagePath")%>' />
   </a>
</div>

Open in new window

0
 

Author Comment

by:R8VI
ID: 24148003
hi jp j78,

I think i might need to use an asp:image control as my backend c# has the following code

 ListViewItem eitm = e.Item;
        object MyColumnValue = ((DataRowView)(((ListViewDataItem)(eitm)).DataItem)).Row["StartUpImagePath"];

       
        Image image = (Image)e.Item.FindControl("imgStartUpImagePath");
        string filePath = MyColumnValue.ToString(); ;

        FileInfo fileInfo = new FileInfo(filePath);

        //append the '\' before the directory name

        DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);

        string parentDir = string.Format(@"\{0}", directoryInfo.Parent);
        image.ImageUrl = "~" + (filePath.Substring(filePath.IndexOf(parentDir)));

this lets me trim off certain things of the string that comes out the database and put in fromt a ~ so it can be the root of the foler

Thanks,

R8VI
0
 
LVL 10

Accepted Solution

by:
JPJ78 earned 2000 total points
ID: 24148492
You can use a function on the img tag to do this...
(I'm not a C# programmer so there might be some errors, but I hope you get the concept.)
<div class="actualImageVid">
   <a href="ShowCommentsforVideos.aspx?Video=<%#DataBinder.Eval(Container.DataItem,"Video_ID")%>">
      <img style="float: left;" src='<%#GetImageUrl(DataBinder.Eval(Container.DataItem,"StartUpImagePath"))%>' />
   </a>
</div>
 
public string GetImageUrl(string filePath)
{
        FileInfo fileInfo = new FileInfo(filePath);
 
        //append the '\' before the directory name
 
        DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
 
        string parentDir = string.Format(@"\{0}", directoryInfo.Parent);
        return "~" + (filePath.Substring(filePath.IndexOf(parentDir)));
}

Open in new window

0
 
LVL 22

Expert Comment

by:prairiedog
ID: 24152705
>>>which means that what i set in the css for the border property get over ridden
No, you don't have style for the image. Your CSS is set on the <div> tag, not on the image control.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 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