String prodName = ((Literal)Repeater1.ItemTemplate.FindControl("LitProdName")).Text;
Error 1 'System.Web.UI.ITemplate' does not contain a definition for 'FindControl' and no extension method 'FindControl' accepting a first argument of type 'System.Web.UI.ITemplate' could be found (are you missing a using directive or an assembly reference?) C:\Users\User\Desktop\WLL\WLL\ProductDetails.aspx.cs 62 68 WLL
public void AddToBasket() { { //String prodName = "Test"; String prodName = ((Literal)Repeater1.ItemTemplate.FindControl("LitProdName")).Text; String prodID = Request.QueryString["productID"]; String userName = User.Identity.Name; String size = "17.5"; int price = 10; { var basket = new Basket(); basket.User = userName; basket.ProductID = Convert.ToInt32(prodID); //basket.ProductName = prodName; basket.Size = size; basket.Price = price; using (ProductContext _db = new ProductContext()) { _db.Baskets.Add(basket); _db.SaveChanges(); } } } }
FindControl
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)