2
Answers

Remove duplicate data with LINQ

Photo of Asp.Net Hein

Asp.Net Hein

9y
406
1
How to remove duplicate from database and bind to drop down list?
 
Example:
I have the data from one of the table in database -> { A,B,C,D,A,B,B,C } .
I just want to  bind to my dropdown list { A,B,C,D }.
 
Can anybody help me in my problem?
Thanks a lot 

Answers (2)

0
Photo of nikshukla
NA 37 0 18y
Check ItemDataBound event of the grid.

i.e.

If e.Item.ItemType = ListItemType.Item OR e.Item.ItemType == ListItemType.AlternatingItem then

      Dim lbl as Label = e.Item.Cell(1).FindControl("YourLabelControl")

      Dim str as String = lbl.Text

      Select Case str
            Case "YES/YES"

                 e.Item.Cells(1).BackColor = Color.Green

            Case "NO/NO"

                 e.Item.Cells(1).BackColor = Color.Red

      End Select
End If

Hope this helps.

Regards,
Next Recommended Forum