Note that there are some explanatory texts on larger screens.

plurals
  1. POImages not displaying, asp:repeater
    text
    copied!<p>Im trying to display name, description and a picture from my database with a repeater. The Name and Description works as they should but the images won't show up. The images is located in a folder in my project and I'm trying to access them with a string that i have stored in the database "path" column.</p> <p>oh, but if I look at the source code of the browser the src="" looks good, and i can even look at the pic in the browser if i paste the src to it..</p> <p>Heres my code:</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;style type="text/css"&gt; .bilder {width:300; height:200; margin: 10px; border: 1px solid black; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Repeater runat="server" ID="minRepeater"&gt; &lt;ItemTemplate&gt; &lt;div class="wrapper"&gt; &lt;h1&gt;&lt;%# DataBinder.Eval(Container.DataItem, "Name") %&gt;&lt;/h1&gt; &lt;span id="desc"&gt;&lt;%# DataBinder.Eval(Container.DataItem, "Description") %&gt;&lt;/span&gt;&lt;br /&gt; &lt;img src="&lt;%# DataBinder.Eval(Container.DataItem, "Path") %&gt;" alt="test" class="bilder" /&gt; &lt;asp:Image ID="Image1" CssClass="bilder" ImageUrl='&lt;%# DataBinder.Eval(Container.DataItem, "Path")%&gt;' runat="server" /&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/div&gt; </code></pre> <p>and codebehind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = connectionstring; SqlCommand com = new SqlCommand(); com.CommandText = "SELECT * FROM Pictures"; com.Connection = con; SqlDataAdapter ad = new SqlDataAdapter(); ad.SelectCommand = com; DataTable dt = new DataTable(); ad.Fill(dt); Response.Write(dt.Rows.Count); minRepeater.DataSource = dt; minRepeater.DataBind(); } </code></pre> <p>(yes i know that my code isn't safe. at all.)</p> <p>here's how it looks in a browser: <img src="https://i.stack.imgur.com/rOeNW.png" alt="enter image description here"></p> <p>any ideas? :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload