Hello Telerik
I have a little issue on adding row to a gridview using a objectquery(Of T) as datasource. The gridview is groupped on two level (fixed by design). Rows are added programmatically on a button click event with the following code.
The issue is that's the EnsureVisible do not expend the good group (on the yellow one on the picture). If the "good" group is expended before the sub, all is goning fine (EnsureVisible do not expand the wrong group).
I have a little issue on adding row to a gridview using a objectquery(Of T) as datasource. The gridview is groupped on two level (fixed by design). Rows are added programmatically on a button click event with the following code.
Private
Sub
AddNew_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
AddNew.Click
Try
'Add a new row
Dim
newrow
As
GridViewRowInfo =
Me
.NotesFrais.Rows.AddNew()
'Set default value on the new data object
Dim
newnotedefrais
As
NoteFrais =
CType
(newrow.DataBoundItem, NoteFrais)
With
newnotedefrais
.DateCreation = Today.
Date
Dim
currentuserguid
As
Guid = GetCurrentUser.Guid
Dim
currentcollaborateur
As
Collaborateur =
Me
._datactx.Collaborateur.
Single
(
Function
(c) c.AD_Guid.Equals(currentuserguid))
.Collaborateur = currentcollaborateur
.IsTemporaire =
True
End
With
'Update the database
Me
._datactx.SaveChanges()
'Select the new row
newrow.EnsureVisible(
True
)
newrow.IsSelected =
True
newrow.IsExpanded =
True
Catch
ex
As
Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation,
"Une erreur est survenue.."
)
End
Try
End
Sub
The issue is that's the EnsureVisible do not expend the good group (on the yellow one on the picture). If the "good" group is expended before the sub, all is goning fine (EnsureVisible do not expand the wrong group).
7 Answers, 1 is accepted
0
Hello Marco,
Thank you for writing.
I have prepared a sample project in which I have established a connection to a small database using EntityFramework. I have successfully added new rows with data when the grid is grouped and the EnsureRow seems to be working correctly. I would suggest that you also invoke InvalidateRow method to have the data refreshed as soon as the new row is added.
I am sending you attached my project, as well as a .gif file showing how the grid looks on my side. Can you please let me know what I am missing?
Regards,
Hristo
Telerik
Thank you for writing.
I have prepared a sample project in which I have established a connection to a small database using EntityFramework. I have successfully added new rows with data when the grid is grouped and the EnsureRow seems to be working correctly. I would suggest that you also invoke InvalidateRow method to have the data refreshed as soon as the new row is added.
I am sending you attached my project, as well as a .gif file showing how the grid looks on my side. Can you please let me know what I am missing?
Regards,
Hristo
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Marco
Top achievements
Rank 2
Veteran
answered on 23 Dec 2014, 08:06 AM
Hello Hristo,
Thank you for the answer.
I will check your sample and if I don't find my solution in it. I would post back a sample project to reproduce this issues, certainly after Christmas break.
Best wishes
Thank you for the answer.
I will check your sample and if I don't find my solution in it. I would post back a sample project to reproduce this issues, certainly after Christmas break.
Best wishes
0
Marco
Top achievements
Rank 2
Veteran
answered on 07 Jan 2015, 10:54 AM
Hello Hristo,
I came back about this problem. First of all thanks for the sample project.
Don't really know why it's not working fine with my project.
Perhaps it's because I'm using two level for grouping (The first level work fine, the problem is about the second level of group, your sample use only one level of grouping perhaps you should try with two group descriptor (something like people grouped by country and gender)).
As the EnsureVisible works fine if the "right" groups are expanded, I expand them manually before calling EnsureVisible. It's an acceptable workaround.
Thanks for you support
I came back about this problem. First of all thanks for the sample project.
Don't really know why it's not working fine with my project.
Perhaps it's because I'm using two level for grouping (The first level work fine, the problem is about the second level of group, your sample use only one level of grouping perhaps you should try with two group descriptor (something like people grouped by country and gender)).
As the EnsureVisible works fine if the "right" groups are expanded, I expand them manually before calling EnsureVisible. It's an acceptable workaround.
Thanks for you support
0
Marco
Top achievements
Rank 2
Veteran
answered on 07 Jan 2015, 11:00 AM
Hello Hristo,
Thank for your sample project.
Invoking InvalidateRow is not helping but expending the group before calling EnsureVisible is making the trick.
You should perhaps try with two level of grouping (something like people grouped by country and gender) because the issue is coming over the second level of grouping in my project.
As I have found an acceptable workaround, I will move to the next topic of my fine tuning ToDoList.
Thank for your sample project.
Invoking InvalidateRow is not helping but expending the group before calling EnsureVisible is making the trick.
You should perhaps try with two level of grouping (something like people grouped by country and gender) because the issue is coming over the second level of grouping in my project.
As I have found an acceptable workaround, I will move to the next topic of my fine tuning ToDoList.
0
Hi Marco,
Thank you for writing back.
I am glad that you found an acceptable workaround. However I am unable to reproduce this behavior on my side.
Please find attached my sample project with two level grouping. I am also sending you a .gif file showing how the grid looks on my side.
If you could provide with more details regarding your scenario I would be happy to examine it further and determine if we had an issue with our control.
Should you have further questions please do not hesitate to write back.
Regards,
Hristo
Telerik
Thank you for writing back.
I am glad that you found an acceptable workaround. However I am unable to reproduce this behavior on my side.
Please find attached my sample project with two level grouping. I am also sending you a .gif file showing how the grid looks on my side.
If you could provide with more details regarding your scenario I would be happy to examine it further and determine if we had an issue with our control.
Should you have further questions please do not hesitate to write back.
Regards,
Hristo
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Marco
Top achievements
Rank 2
Veteran
answered on 12 Jan 2015, 05:37 PM
Hi Hristo,
Thanks for the update.
I will be really happy to make a test project with this issue but the form is quite complex and had some dependencies. So I couldn't make a simple copy paste for the sample. I will keep a post-if in one of the corner of my screen about building a sample app but as I found a workaround you will understand that I won't put an high priority on it.
Either way it's actually working that's the main subject after all. Quality and feedback could wait a few day!
Have a nice day.
Thanks for the update.
I will be really happy to make a test project with this issue but the form is quite complex and had some dependencies. So I couldn't make a simple copy paste for the sample. I will keep a post-if in one of the corner of my screen about building a sample app but as I found a workaround you will understand that I won't put an high priority on it.
Either way it's actually working that's the main subject after all. Quality and feedback could wait a few day!
Have a nice day.
0
Hello Marco,
Good luck with your project.
Feel free to contact us again anytime regarding the issue you described. I would be happy to further investigate it.
Also any other questions regarding our controls are always welcome.
Regards,
Hristo
Telerik
Good luck with your project.
Feel free to contact us again anytime regarding the issue you described. I would be happy to further investigate it.
Also any other questions regarding our controls are always welcome.
Regards,
Hristo
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.