Click here to Skip to main content
15,949,741 members

Comments by cnjadhav (Top 19 by date)

cnjadhav 18-Oct-11 12:04pm View    
its the Line before that, where the Image is not been found, Image imgProduct = (Image)e.Item.FindControl("imgProduct"); imgProduct is "null"
cnjadhav 18-Oct-11 11:35am View    
its the Line before that, where the Image is not been found,
Image imgProduct = (Image)e.Item.FindControl("imgProduct");
imgProduct is "null"
cnjadhav 18-Oct-11 10:01am View    
If i do that, it seems to find the controls but i get the same "null" reference error for OnitemDataBound event imgproduct, here's my event
protected void productListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{

Product p = (Product)e.Item.DataItem;
Image imgProduct = (Image)e.Item.FindControl("imgProduct");
imgProduct.ImageUrl = "/ShoppingCart/ProductPics.ashx?pid" + p.ProductID.ToString() + "&s" + Settings["product_picSize"].ToString();

}
}
cnjadhav 29-Jul-11 9:06am View    
Deleted
Thanks guys, got it working here's my solution:

public static Quotes GetRandomQuotes()
{
HsInternetDBDataContext db = new HsInternetDBDataContext();
var query = from c in db.Quotes select c;
int count = query.Count();

if (query.Count() > 0)
{
Random r = new Random();
return new Quotes(query.ToList()[r.Next(0, count)]);
}
else
{
return new Quotes();
}
}
cnjadhav 8-Jul-11 12:28pm View    
i mean how do i use FileInfo or the DirectoryInfo(server.MapPath(????callthebytearray)) to get the array of bytes?