im trying to put a double - price in a label which will show the full price.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.Footer)
{
Label labelFooter = (Label)e.Row.Cells[5].FindControl("LabelFooter");
Cart c = (Cart)Session["cart"];
double sum = c.TotalPrice();
labelFooter.Text = sum.ToString();
}
}
and then I get for the last line(labelFooter.Text = sum.ToString()):
System.NullReferenceException: 'Object reference not set to an instance of an object.'
edit:ok the problem is not with the convert