hide duplicate rows in asp.net


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: hide duplicate rows in asp.net

  1. #1
    Join Date
    Feb 2010
    Posts
    3

    hide duplicate rows in asp.net

    I have a column structure in gridview

    account dept1 dept2 dept3

    1 1

    1 1

    1 1

    2 12

    3 1

    3 12

    These rows are different records from database.

    I want to have

    account dept1 dept2 dept3

    1 1 1 1

    2 12

    3 1 12


    Is there a way to hide rows and display data correctly.

    Right now I have data in a dataset in c#.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    And are you building your dataset through an SQL query to your backend database?

    If so, then that is where the filtering would be going on and the gridview would be used just for display purposes.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Feb 2010
    Posts
    3
    yes I use gridview to display the result.. but its an aspxgridview. but as far as i can make dataset schemna proper it will display well. I thought of cloning the database and adding new columns and displaying result, but have not been successful

  4. #4
    Join Date
    Jul 2007
    Posts
    46

    Wink

    This will solve the prblem:

    Public Shared Sub RemoveDuplicateItems(ByVal ddl As DropDownList)

    Dim i As Integer = 0
    While i < ddl.Items.Count
    ddl.SelectedIndex = i
    Dim str As String = ddl.SelectedItem.ToString()
    Dim counter As Integer = i + 1
    While counter < ddl.Items.Count
    ddl.SelectedIndex = counter
    Dim compareStr As String = ddl.SelectedItem.ToString()
    If str = compareStr Then
    ddl.Items.RemoveAt(counter)
    counter = counter - 1
    End If
    System.Math.Max(System.Threading.Interlocked.Increment(counter), counter - 1)
    End While
    System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
    End While
    End Sub


    Call function as:

    RemoveDuplicateItems(DropDownList1)

  5. #5
    Join Date
    Feb 2010
    Posts
    3
    I am not working on dropdownlist. So I am not sure how will it solve my issue

Similar Threads

  1. hide all existing rows in datagridview
    By crystalelle in forum .NET
    Replies: 4
    Last Post: 03-18-2008, 11:25 AM
  2. Hide datagrid rows that has data.
    By crystalelle in forum .NET
    Replies: 6
    Last Post: 03-01-2008, 01:05 PM
  3. Replies: 7
    Last Post: 12-12-2007, 07:30 AM
  4. HIghlight duplicate rows in excel
    By v_gyku in forum VB Classic
    Replies: 2
    Last Post: 09-03-2005, 07:45 AM
  5. Duplicate Rows in SQL
    By Jeff Powell Jonsson in forum VB Classic
    Replies: 0
    Last Post: 07-18-2002, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center