I need to fill a grid line with information obtained after clicking ctrl + L.
ctrl + L is obtained through the rTalao.TableControlCurrentCellKeyUp event.
as a result I get a datatable with several columns that I want to insert into the grid.
I can't do this insert/update in the grid.
can someone help me, explaining to me how this can be done.
Thanks
|
//Event subscription
gridGroupingControl1.TableControlCurrentCellKeyUp += GridGroupingControl1_TableControlCurrentCellKeyUp;
//Event subscription
private void GridGroupingControl1_TableControlCurrentCellKeyUp(object sender, GridTableControlKeyEventArgs e)
{
if ((Control.ModifierKeys == Keys.Control) && e.Inner.KeyCode == Keys.L)
{
//To update current record.
e.TableControl.Table.CurrentRecord.SetValue("Country", "India");
}
} |
Hi,
thanks for your help. i will try this and let you know if it worked
Ricardo
good morning
I am using this function to do ctrl + L on the grid
Private Sub GridGroupingControl1_TableControlCurrentCellKeyUp(sender As Object, e As GridTableControlKeyEventArgs) Handles GridDoc.TableControlCurrentCellKeyUp
Dim keyCode As Keys = Keys.KeyCode
Dim rec As Record
If e.TableControl.CurrentCell.ColIndex = 2 Then
Select Case e.Inner.KeyCode
Case Keys.L
If e.Inner.Control = True Then
Dim oLista As New cl_Listas
Dim sTmp As String
sTmp = oLista.ListaArtigos
If sTmp > "" Then
e.TableControl.Table.CurrentRecord.SetValue("Artigo", sTmp)
e.TableControl.Table.CurrentRecord.SetValue("Data", DateTime.Now)
e.TableControl.Table.CurrentRecord.SetValue("Cliente", tb_cliente.Text.ToString)
e.TableControl.Table.CurrentRecord.SetValue("ArtigoSage", "")
e.TableControl.Table.CurrentRecord.SetValue("Descr", "")
e.TableControl.Table.CurrentRecord.SetValue("Observacoes", "")
e.TableControl.Table.CurrentRecord.SetValue("Quantidade", "")
e.TableControl.Table.CurrentRecord.SetValue("Preco", "")
' To trigger the CurrentCellValidating event.
e.TableControl.CurrentCell.Validate()
Else
End If
oLista = Nothing
End If
Case Else
Exit Select
End Select
Else
End If
End Sub
but it gives this error "AddNew not called"
This happens when the grid has this symbol
When you have this symbol nothing happens
Hi Ricardo Abranches,
We have checked the reported scenario. Unfortunately, we are unable to reproduce the mentioned error "AddNew not called." However, we observed that when pressing CTRL + L on the second column, the value changes correctly. But when entering any value in the cell and then pressing CTRL + L, the value does not change; it only changes after moving to another cell.
Could you please confirm whether the issue you are facing is that the value does not change when entering any value into the cell? We have attached the video reference below.
If we have misunderstood your requirement, could you please provide more information about the error you have mentioned? This will help us validate it and provide a solution as soon as possible.
Regards,
Sreemon Premkumar M.
God morning
I have a gridGroupingcontrol with 1 data Source = select from sql Server table
I do Ctrl + L and open a window where I choose a value
article. oRes = oArt.Artigo_get(sTmp)
by placing this value in the grid e.TableControl.Table.CurrentRecord.SetValue("Artigo", sTmp)
I get the error System.InvalidOperationException: 'AddNew not called'
If I execute an addNew before, I will end up with a new row.
what I think is going on.
When a line has * at the beginning, it does not yet exist. That's why you need addNew. I must do something before trying to fill the line.
thanks
If the DataSource doesn't have any rows, it works fine, but if it has some rows, it doesn't work anymore
Hi Ricardo Abranches,
We are currently checking the reported issue. We need some time to validate, and we will provide you further update on or before April 25, 2024.
Regards,
Sreemon Premkumar M.
Hi Ricardo Abranches,
We have checked this behavior in the source. Like you said, the reason for the exception being thrown is that when you try to set the value by pressing CTRL + L to add a new row, the row has not yet been created and it was described as '*'. The row gets created after you have entered a character into it. So it works fine without the exception.
We found that even with or without the rows, the behavior was the same. If there is no row in the control, when trying to set the value to the cells, it still throws the exception.
However, to meet this requirement of setting the value inside the 'add new row,' you need to call the GridTable.BeginEdit method to create the row before setting the value. Please find the code snippet below:
Code snippet:
if (e.Inner.Control) { string sTmp = "New Artigo"; if (!string.IsNullOrEmpty(sTmp)) { // before setting the value, you need to call the BeginEdit method to get the row for the Add new row. this.gridGroupingControl1.TableControl.Table.CurrentRecordManager.BeginEdit(); e.TableControl.Table.CurrentRecord.SetValue("Name", "New Name"); e.TableControl.Table.CurrentRecord.SetValue("Id", "22"); e.TableControl.Table.CurrentRecord.SetValue("Start Date", "New Start Date"); e.TableControl.Table.CurrentRecord.SetValue("Country", "New Country"); e.TableControl.Table.CurrentRecord.SetValue("Ship City", "New Ship City"); // To trigger the CurrentCellValidating event. e.TableControl.CurrentCell.Validate(); } |
We have prepared the sample based on this, please find it in the attachment.
Regards,
Sreemon Premkumar M.
YES !!!!
it worked, thank you
but if it is already in a filled row, if I change column 2 (with CTRL + L) it does not fill in the remaining columns, as it does in insertion mode
Hi Ricardo Abranches,
We have checked the reported issue wherein, when trying to set the value in an already filled row, the value was not set to the remaining columns other than column2. However, we observed that the values are properly updated in other columns but not in the second column. So, we suggest you check whether the current row was the add new row or not before calling the BeginEdit method. Please find the code snippet below.
Code snippet:
if(gridGroupingControl1.Table.DisplayElements[this.gridGroupingControl1.Table.CurrentRecord.GetRowIndex()].Kind == DisplayElementKind.AddNewRecord) { this.gridGroupingControl1.TableControl.Table.CurrentRecordManager.BeginEdit(); } |
If the issue still persists, and if we misunderstood the issue, could you please provide more information regarding the issue? We will validate and provide you with the proper solution.
Regards,
Sreemon Premkumar M.
Hello,
I was struggling with GridGroupingControl, I didn't understand why your example worked well, but not in my project.
until I discovered this particularity
Public Sub New()
...
'gridGroupingControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Office2016Colorful
gridGroupingControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Office2010Blue
...
End Sub
If I choose Syncfusion.Windows.Forms.GridVisualStyles.Office2016Colorful it doesn't allow me to add rows to the grid.
If I choose Syncfusion.Windows.Forms.GridVisualStyles.Metro it doesn't allow me to add rows to the grid.
But if I choose Syncfusion.Windows.Forms.GridVisualStyles.Office2010Blue it works
Is there a way to overcome this situation?
The attached example demonstrates the problem.
Thank you
Hi Ricardo Abranches,
We are currently checking the reported issue with the sample you have provided. We need some time to validate it, and we will update you further details on or before August 28, 2024.
We appreciate your patience until then.
Regards,
Sreemon Premkumar M.
Hi Ricardo Abranches,
We have created a bug report for the reported issue “The 'Add new records' feature gets disabled when using the Office2016 and Metro themes in GridGroupingControl.”. We will include this fix in our upcoming Weekly NuGet release which is scheduled for September 24, 2024.
We will update you with the feedback details tomorrow.
Regards,
Sreemon Premkumar M.
Hi Ricardo Abranches,
We have created a bug report for the reported issue “Add new row gets disabled when using the Office2016 and Metro themes in GridGroupingControl”. We will include this fix in our upcoming Weekly NuGet release which is scheduled for September 24, 2024.
You can track the status of this report through the following feedback link,
Note: The provided feedback link is private, and you need to login to view this feedback.
We will let you know once it is released. We appreciate your patience until then.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
In the meantime, you can set the AllowNew property to true to display the 'Add New Row' after applying the theme. Please find the code snippet below.
gridGroupingControl1.GridVisualStyles = GridVisualStyles.Office2016Colorful; this.gridGroupingControl1.TableDescriptor.AllowNew = true; |
Regards,
Sreemon Premkumar M.
Hi Ricardo Abranches,
We would like to let you know that Essential Studio Weekly NuGet packages (v27.1.50) has been published in nuget.org with the fix for the issue “Add new row gets disabled when using the Office2016 and Metro themes in GridGroupingControl”. Please let us know if you have any concerns in this.
Root Cause Details:
Initially, we had disabled the 'AllowNew' API in the GridGroupingControl for the Office2016 and Metro themes. We have now enabled this API for these themes in the GridGroupingControl.
Regards,
Sreemon Premkumar M.
Thanks, i will test it
Hi Ricardo Abranches,
Please test and let us know the results. We will wait until we hear from you!
Regards,
Sreemon Premkumar M.