I am using an wingrid that is bound to a collection. I have used a cellchange event to keep track of when a specific cell value changes. I want to store the row wherein the value of the cell changes in an arraylist. Can you suggest what i am doing wrong or probably a better solution.
void BillofToursGrid_CellChange(object sender, CellEventArgs e)
{
if (BillofToursGrid.DisplayLayout.Rows.Band.Columns["Capacity"].CellClickAction = CellClickAction.Edit)
collectionGridAdd();
}
protected void collectionGridAdd()
BillofToursGrid.DataSource = new TourModelCollection();
BillofToursGrid.DataBind();
billoftoursCapacityinfo.Add(BillofToursGrid.DataSource);
Hi,
I'm not sure I understand what you are trying to do here, but this code doesn't make a lot of sense to me.
You are setting the DataSource of the grid inside the CellChange event? Why would you do that? Every time the user edits a cell, you will basically be throwing away their changes and creating a new data source for the grid.
Also, it's not neccessary to call DataBind on the grid. Setting the DataSource does an implicit DataBind, so you are essentially binding twice here.
And then you are adding, not the row, but the entire grid's data source to a list of some kind.