We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Getting the Row/Column index inside a RecordDeleted event

Thread ID:

Created:

Updated:

Platform:

Replies:

31410 Jul 7,2005 03:29 AM Jul 7,2005 05:54 AM Windows Forms 1
loading
Tags: GridControl
Thabo
Asked On July 7, 2005 03:29 AM

Hi, My grid is a GGC, and one of the columns in it has a ComboBox. In my RecordDeleted event, i want to get the Row index and Column index of a Column that contains a ComboBox i.e. the if the user deletes the second row from a GGC, is it possible to get the row index and column index of a column that contains the combobox on the row the user is deleting. here is my sample code: private void dataSheetControl_RecordDeleted(object sender, Syncfusion.Grouping.RecordEventArgs e) { int count = 0; foreach(GridVisibleColumnDescriptor cd in this.dataSheetControl.TableDescriptor.VisibleColumns) { count++; if (this.dataSheetControl.TableControl.Model.CellMod els.ContainsKey("ComboBox")) { int colIndex = count; break; } } DataRow current_row = this.GetRow(this.CurrentCell.RowIndex,colIndex); int id = Convert.ToInt32( current_row[ this.descriptor.PrimaryField.Name ] ); descriptor.DeleteListFromRelation(id); } This doesn''t seem to work because when a row is deleted, there is no current active cell. Actually what i''m looking for is a way to somehow get the Row and Column index of a cell that contains a combobox in the row being deleted. If it''s not possible to do it in the RecordDeleted event, is it possible to do it using the TableControlCurrentCellKeyDown event. here is the sample code for this event handler: public void dataSheetControl_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e) { if(e.Inner.KeyCode == Keys.Delete) { //my code here } } Regards David

Administrator [Syncfusion]
Replied On July 7, 2005 05:54 AM

Why do you need the actual row and column index in the RecordDeleted event? It can be found if you really need it, but if you want just want teh value of this column from that record, then there are simpler ways to get it. These row and column index values can change as you sort things or move columns or group or ?? So, it is probably not a good thing to try to save these values for use later. Do you know the name of the column holding the combobox? If so, and all you want is the value, then you can use code like this to get it in the key down event.
private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
	if(e.Inner.KeyCode == Keys.Delete)
	{
		if(this.gridGroupingControl1.Table.CurrentRecord != null)
		{
			Console.WriteLine(this.gridGroupingControl1.Table.CurrentRecord.GetValue("Col2"));
			//this.gridGroupingControl1.Table.CurrentRecord.Delete();
		}
	}
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;