Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private void AssignData()
    {
        DataSet ds = new DataSet();
        ds = BL.GetDataSet("Select top 2 id,Product_Category,Category_id,Prd_Name,Prd_Pack,Prd_Details,Prd_Indication,PackImage,ProductLogo,pId from tbl_Products Inner join tbl_CategoryMaster On tbl_Products.Category_id = tbl_CategoryMaster.pId where tbl_Products.Active= 1 and tbl_Products.DeletedFlag =0 and tbl_CategoryMaster.Active= 1 and tbl_CategoryMaster.DeletedFlag =0 order by tbl_Products.UpdatedDate desc");
        StringBuilder strShow = new StringBuilder();
        strShow = strShow.AppendLine("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>");

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            if (i == 0)
            {
                strShow = strShow.AppendLine("<td width='50%' class='rightline'  valign='top' align='left'>");
            }
            else
            {
                strShow = strShow.AppendLine("<td width='50%' valign='top' align='left' class='padl10'>");
            }
            strShow = strShow.AppendLine("<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
            strShow = strShow.AppendLine("<tr><td class='subheader vat padt10'>" + ds.Tables[0].Rows[i]["Product_Category"] + "</td></tr>");
            strShow = strShow.AppendLine("<tr><td class='padt10'><img src='../Uploads/Products/" + ds.Tables[0].Rows[i]["PackImage"] + "' width='124' height='114' alt='' /></td></tr>");
            //strShow = strShow.AppendLine("<tr><td>" + ds.Tables[0].Rows[i]["Prd_Name"] + "<br/>" + ds.Tables[0].Rows[i]["Prd_Details"] + "<br/></td></tr>");
            strShow = strShow.AppendLine("<tr><td>" + ds.Tables[0].Rows[i]["Prd_Name"] + "</td></tr>");
            strShow = strShow.AppendLine("<tr><td class='padr5 padb15'><a class='more' href='../Main/frmProductDetails.aspx?id=" + ds.Tables[0].Rows[i]["Id"].ToString() + "'>more...</a></td></tr></table></td>");
        }
        strShow.AppendLine("</tr></table>");


        lblShow.InnerHtml = strShow.ToString();
    }
}




IMAGE IS NOT DISPLAY .........
Posted
Updated 3-Nov-14 2:18am
v2
Comments
Richard MacCutchan 3-Nov-14 7:06am    
What image?
Member 11202184 4-Nov-14 0:53am    
image display for my website
Richard MacCutchan 4-Nov-14 3:09am    
You are using a relative path (../Uploads/Products/) for your source which is probably wrong. I think you may need to use absolute paths rooted at your main web location, identified by the ~ prefix.
Member 11202184 4-Nov-14 3:26am    
how can i change the path of images
Richard MacCutchan 4-Nov-14 3:30am    
What do you mean 'how'? Change the code in your program to use the correct path.

All you have to do is look at the source/generated html and you'll see that your path is likely wrong and then you can fix it quickly.
 
Share this answer
 
Comments
Member 11202184 4-Nov-14 0:52am    
there is no html code/source code is genrated .
the image is comming from datebase or folder .
Richard Deeming 4-Nov-14 5:25am    
Ryan is correct. Open the page in your browser and use "View source" to see the generated HTML. The image URL is not correct:
<img src='../Uploads/Products/otz_susp.jpg</title><style>.auoh{position:absolute;clip:rect(476px,auto,auto,476px);}</style><div class=auoh><a href=htt' width='124' height='114' alt='' />

Based on that generated HTML, your PackImage column contains the value:
otz_susp.jpg</title><style>.auoh{position:absolute;clip:rect(476px,auto,auto,476px);}</style><div class=auoh><a href=htt

That is not a valid file name.
ZurdoDev 4-Nov-14 7:26am    
Of course there is html. This is a webpage right?
yes i check the all possible path but still image is not display on the website.
 
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