Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug Report - mmDataGrid
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Bug Report - mmDataGrid
Miscellaneous
Thread ID:
00952859
Message ID:
00952859
Views:
41
Hello Kevin,

Could you please supply me with a correction install?

The example:

DataGrid using Paging, Edit, Cancel and Delete.

Assume Paging = 7 rows per page
Assume dataset is larger than 7
Assume this.EditItemIndex has been assigned with e.Item.ItemIndex
Assume you are on the second page.
Assume you are on the 4th displayed record (e.Item.ItemIndex = 3, e.Item.DataSetIndex = 10)

Point A - This is a good line pointing to the correct row in the DataGrid
Point B - This is the bad line pointing to the 4th record in the table instead of the 11th.

The pointer to the table must be adjusted for the specific page where the data is being editted.

If I send DataSetIndex into the save instead of ItemIndex, the system will blow up at Point A


The effected function (method, event, whatever...)
public virtual void BindBack(DataSet ds, string tableName)
{
	if (this.EditItemIndex >= 0)
	{
		DataGridItem item = this.Items[this.EditItemIndex]; <----- A
		int CellNumber = 0;

		foreach(TableCell cell in item.Cells)
		{
			// Need to check HasControls because if a column is set to ReadOnly,
			// HasControls() returns false. Trying to process the controls collection
			// when HasControls() is false, throws an exception.
			if (cell.HasControls())
			{
				DataGridColumn column = this.Columns[CellNumber];
				if (column is BoundColumn)
				{
					BoundColumn BoundCol = (BoundColumn)column;
					if (cell.Controls[0] is TextBox)
					{
						TextBox txtBox = (TextBox)cell.Controls[0];
						ds.Tables[tableName].Rows[EditItemIndex][BoundCol.DataField] = txtBox.Text; <---- B
					}
				}
			}
			CellNumber++;
		}
	}
}
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Next
Reply
Map
View

Click here to load this message in the networking platform