Jake_vbulletin3_import12169
New Member
I'm having problem updating my datagrid. When I click the update button, the content of the cell stays the same. Although the old row is replace with a new one but the data remain thesame. Everything looks ok since the data in the new row match with the old one, it means I'm accessing the cells correctly. It looks like the data is cached or something. Although I cleared the cache, but the problem persist. Has anyone experience such a thing with datagrid control? Here's the code I'm using:<BR><BR>protected void MyDataGrid_Update(Object Sender, DataGridCommandEventArgs e) <BR> {<BR>DataTable Cart = (DataTable)Session["ShoppingCart"];<BR>DataView CartView = new DataView(Cart);<BR>string strQuantity= ((TextBox)e.Item.Cells[4].Controls[0]).Text;<BR> string itemId = e.Item.Cells[2].Text;<BR> string item = e.Item.Cells[3].Text;<BR> string price = e.Item.Cells[5].Text;<BR> // Remove old entry<BR> CartView.RowFilter = "Item='" + item + "'";<BR> if (CartView.Count > 0)<BR> CartView.Delete(0);<BR> CartView.RowFilter = "";<BR> //Add new entry.<BR> DataRow DR = Cart.NewRow(); <BR> DR[0] = itemId;<BR> DR[1] = item;<BR> DR[2] = strQuantity;<BR> DR[3] = price;<BR> Cart.Rows.Add(DR);<BR> CartList.EditItemIndex = -1;<BR><BR>DataTable CartListTable = (DataTable)Session["ShoppingCart"];<BR>DataView CartListView = new DataView(CartListTable);<BR>if (CartList.Attributes["SortExpression"] != null )<BR> {<BR>CartListView.Sort = CartList.Attributes["SortExpression"];<BR> } <BR> CartList.DataSource = CartListView;<BR> CartList.DataBind();<BR> BindTotalList();<BR> }