Hi friends i am making an application in which i am building a shopping cart.
User will select the product and click on "Add to cart" button.The product will be added to shopping cart.Details will be send from a detailview in which i am showing the details of the product directly from the database.
The code for sending the details to the shopping cart is
DetailsViewRow dr1 = (DetailsViewRow)((Button)sender).Parent.Parent;
string name = ((Label)dr1.FindControl("Label3")).Text;
string price = ((Label)dr1.FindControl("Label2")).Text;
string id = ((Label)dr1.FindControl("Label4")).Text;
string quantity = ((TextBox)dr1.FindControl("txtQuantity")).Text;
LineItem item1 = new LineItem(int.Parse(id), name, double.Parse(price), int.Parse(quantity));
Invoice ord1 = (Invoice)Session["basket"];
ord1.AddItem(item1);
Server.Transfer("ShoppingCart.aspx");
but i am getting an error
Unable to cast object of type 'System.Web.UI.HtmlControls.HtmlForm' to type 'System.Web.UI.WebControls.DetailsViewRow'.
I tried to solve it but with no luck.
Can any one help me