Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay Images from Mysql database in Datalist
    primarykey
    data
    text
    <p>I save image path and image name in myqsl database. Now I want to display images from database on asp.net data-list. I have query result like this <img src="https://i.stack.imgur.com/C5LMq.png" alt="enter image description here"></p> <p>I want to display picture with pageName. I do some thing like this on datalst.</p> <pre><code>&lt;asp:DataList ID="dtlistImages" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" BorderColor="#336699" BorderStyle="Solid" BorderWidth="2px"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblID" runat="server" Text='&lt;%# Eval("pageName") %&gt;' Font-Bold="true" Font-Size="10pt" ForeColor="#336699" Width="100%"/&gt; &lt;/br&gt; &lt;asp:Image ID="imgnewspaper" runat="server" ImageUrl='&lt;%# Eval("pageNumber") %&gt;' /&gt; &lt;/ItemTemplate&gt; &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Top" /&gt; &lt;/asp:DataList&gt; </code></pre> <p>Code Behind:</p> <pre><code> public DataTable getData(string query) { MySqlConnection conn1 = new MySqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString); conn1.Open(); MySqlCommand cmd = new MySqlCommand(query, conn1); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return dt; } protected void btnshow_onclick(object sender, EventArgs e) { string query = "select cap_newspaper_page.pageServer,cap_newspaper_page.pagePath, pageNumber,pageName,newspaper.newspaperName,newspaper_station.newspaperStationName"+ " FROM cap_newspaper_page Inner Join cap_newspaper ON cap_newspaper_page.capnewspaperID = cap_newspaper.capnewspaperID inner join newspaper on newspaper.newspaperID=cap_newspaper.newspaperID"+ " inner join newspaper_station on newspaper_station.newspaperStationID=cap_newspaper.newspaperStationID where cap_newspaper.newspaperID="+ddlNewspaper.SelectedValue+" and cap_newspaper.newspaperStationID="+ddlNewspaperStation.SelectedValue+" and cap_newspaper_page.publishDate='"+tbDate.Text+" 00:00:00'"; dtlistImages.DataSource = getData(query); dtlistImages.DataBind(); } </code></pre> <p>but display is like this <img src="https://i.stack.imgur.com/okBZ9.png" alt="enter image description here"></p> <p>How I can Display images also dynamically. based on query.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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