This is a migrated thread and some comments may be shown as answers.

Deduplicate on a column fails

2 Answers 6 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Fit2Page asked on 11 May 2015, 08:36 AM

I encouter a strange behavior when I try to de-duplicate a grid with this code:

Protected Sub dtgProducts_ItemCreated(sender As Object, e As GridItemEventArgs)
 
    If (TypeOf (e.Item) Is GridDataItem) Then
 
 
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
 
        Response.Write(ProductMem & "-" & item.GetDataKeyValue("ProductCode") & "<br>")
 
        If item.GetDataKeyValue("ProductCode") = ProductMem Then 'ontdubbelen voor de zoekfunctie
            item.Display = False
        End If
 
        ProductMem = item.GetDataKeyValue("ProductCode")
    End If
End Sub

 

With four data items with ProductCode 106901AS404, the output is:

 

106901AS404-106901AS404
106901AS404-106901AS404
106901AS404-106901AS404
106901AS404-106901AS404

 

So how could ProductMem already be set on '106901AS404' in the first loop when no preceding item exists?

 

Please reply soonest, this is an urgent one...

 Thanks,

Marc

2 Answers, 1 is accepted

Sort by
0
Accepted
Angel Petrov
Telerik team
answered on 14 May 2015, 07:56 AM
Hello Marc,

I am experiencing difficulties understanding the problem. As far as I understand the code it looks like it is working correctly. If the ProductMem variable(which seems to be global) contains the value it is expected to receive such an output.

Could you please elaborate in detail on the exact problem? Additionally can you please share with us the entire page contents(markup and code-behind) so we could examine the implementation.

Regards,
Angel Petrov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 27 May 2015, 11:59 AM

Yes indeed works as expected.

 

Marc

Tags
Grid
Asked by
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Angel Petrov
Telerik team
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Share this question
or