I've a tricky question (for me thou... :))
Problem: Cant change the value to my databas because it wont go through my "foreach" loop.
The funny part is that the foreach loop function when I put it into the Page_Load. But I don't want it there!
How will I make it work?
I want this code in my button event, so when I click on my button this code will be executed.
See the code below what I am trying to do.
(and yes, my "item.contr ols[7] etc." are correct!)
Problem: Cant change the value to my databas because it wont go through my "foreach" loop.
The funny part is that the foreach loop function when I put it into the Page_Load. But I don't want it there!
How will I make it work?
I want this code in my button event, so when I click on my button this code will be executed.
See the code below what I am trying to do.
(and yes, my "item.contr ols[7] etc." are correct!)
Code:
protected void ChangeShoppingCartValues(){ string CartID = Session["CartID"].ToString(); bloggRepeater.DataSource = ManageProductCatalog.getProductsFromShoppingCart(CartID); bloggRepeater.DataBind(); foreach (RepeaterItem item in bloggRepeater.Items){ string antal = ((TextBox)item.Controls[7]).Text.ToString(); string produktID = ((Label)item.Controls[3]).Text.ToString(); string CartRowID = ((Label)item.Controls[5]).Text.ToString(); ManageProductCatalog.UpdateProductsInShoppingCart(CartID, Convert.ToInt32(produktID), Convert.ToInt32(CartRowID), Convert.ToInt32(antal)); }}
Comment