Click here to Skip to main content
15,911,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void search()
  {
      conn.Open();
      string str1 = "select top 1 Price,Descriptions,Title, Image1 + '~/AdImage/' as url ,descriptions from AdMaster1 order by NEWID()
";

      SqlCommand cmd1 = new SqlCommand(str1, conn);

      SqlDataAdapter sd1 = new SqlDataAdapter(cmd1);
      DataTable dt = new DataTable();
      sd1.Fill(dt);
      if (dt.Rows.Count > 0)
      {
          cdcatalog.DataSource = dt;
          cdcatalog.DataBind();
      }
     conn.Close();
     }


////////////
repeater code
ASP.NET
<asp:Repeater id="cdcatalog" runat="server">


                                                  <ItemTemplate>
                                                 <table>
                                                     <tr>
                                                         <td><b>Price:-<%# Eval("Price")%></b></td>
                                                     </tr>
                                                     <tr>


                                                         <td> <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("url") %>' width="200px" height="200px" />

                                                         </td>
                                                         <td>
                                                            <h3>  &nbsp; &nbsp; &nbsp;<%# Eval("descriptions")%>]</h3>
                                                         </td>
                                                     </tr>
                                                     <tr>
                                                         <td><b> <%# Eval("Title")%></b></td>
                                                     </tr>
                                                    </table>



{{{{{{image is not showing,while other data is showing}}}}}}}
Posted
Updated 20-Jan-16 20:18pm
v2
Comments
F-ES Sitecore 21-Jan-16 8:33am    
View the source html, what is the url in the src attribute of your image? In your SQL you're adding the path *after* the image filename, not before it.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900