Hi,
I am using databroundgrid. I would like to have several options to edit the cell
1. The user can edit the cell by himself
2. The user should be able to use Ctrl-Mouse click to select multiple rows/cols/cells and add 1 to all
I have two questions, where can I get information about which cols/rows/cells are currently get selected?
When the data changed inside the cell and the CurrentCellEditingComplete get called, which can I get that row''s number from the event? My grid get polulated by a query on several table joins. I am basically try to grad the key from another col in the row while one cell value get changed, then I will update the DB based on that cell value (or is there a better way?).
Thanks a lot
Chris
AD
Administrator
Syncfusion Team
August 27, 2004 01:52 PM UTC
Here is a KB on how you can get the selections.
http://www.syncfusion.com/Support/article.aspx?id=564
To get the row/col of the currentcell, you can try
GridCurrentCell cc = this.grid.CurrentCell;
// cc.RowIndex and cc.Colindex will give you the row/col
//cc.Renderer.ControlText will give you the new text if the cell is being edited.
AD
Administrator
Syncfusion Team
August 27, 2004 05:31 PM UTC
Thanks Clay. Further question on that CurrentCellEditingComplete.
It seems the event will be triggered as long as I click cell. In fact, I only want it triggered when the content inside the cell is changed. Is there any way to do it?
Thanks
Chris
>Here is a KB on how you can get the selections.
>http://www.syncfusion.com/Support/article.aspx?id=564
>
>To get the row/col of the currentcell, you can try
>
>GridCurrentCell cc = this.grid.CurrentCell;
>// cc.RowIndex and cc.Colindex will give you the row/col
>//cc.Renderer.ControlText will give you the new text if the cell is being edited.
>
AD
Administrator
Syncfusion Team
August 27, 2004 05:47 PM UTC
Try using the CurrentCellValidating event. It is only raised when you leave a cell that has been modified.
AD
Administrator
Syncfusion Team
August 27, 2004 06:19 PM UTC
Thanks Clay. You are the best!
>Try using the CurrentCellValidating event. It is only raised when you leave a cell that has been modified.
TH
Thiyagu
August 28, 2004 08:48 AM UTC
Hi Clay,
Can you plz guide in doing the following.
I''ve GDBG grid. The grid will be in read-only mode, until the user selects a particular row and then click on Edit button. Here How I can get the selected row alone as editable??...
Thanx in advance
Thiyagu.
AD
Administrator
Syncfusion Team
August 28, 2004 09:10 AM UTC
Try this. In your button click, set a member, say editatbleRowIndex, to be the row you want your user to be able to edit. Initially set editatbleRowIndex = -2; (Not -1).
Then handle grid.Model.QueryCellInfo. In your handler, if e.RowIndex = editatbleRowIndex and e.ColIndex >0, set e.Style.ReadOnly = false;
Also handle the RowEnter event. There set editatbleRowIndex = -2.
I think this should turn off Readonly for the row whose RowIndex is editatbleRowIndex. When you enter a different row, the editatbleRowIndex value is set to -2 so no row is editable.
TH
Thiyagu
August 28, 2004 09:28 AM UTC
Thanks Clay for ur immediate response.
I''ll try this tommorrow and will let u know the status. Once again, Thank u very much.
Thiyagu.
TH
Thiyagu
August 30, 2004 01:39 AM UTC
Hi Clay,
I''m having a GDBG Grid in a form. Here, I want the focus to be on the lastRow of the Grid when the Form gets Loaded??..As of now, the Focus is on the header.
ThanX for Ur Help in advance.
Thiagu.
TH
Thiyagu
August 30, 2004 04:04 AM UTC
Hi Clay,
I tried ur suggestions. But stil, the selected row is in Readonly mode. Will be gratefull if you can help ASAP.
FYI.. My Need is to turn the selected row in to edit mode when the user clicks on Edit button.
Thiyagu.
AD
Administrator
Syncfusion Team
August 30, 2004 08:55 AM UTC
Here is a sample that makes the current row editable when you click a button.
WindowsApplication17_8041.zip