Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

is there an easy way to supress repeating rows in a datagrid?

 

For example if 3 rows of data looks like this.

 

Acct No F.Name L.Name Address

---------------------------------------------------------------------------

123456 Johnny Speller 789 Elm Street

654311 Johnny Speller 789 Elm Street

241454 Johnny Speller 789 Elm Street

 

 

and I want it to display on the page like this:

 

 

Acct No F.Name L.Name Address

---------------------------------------------------------------------------

123456 Johnny Speller 789 Elm Street

654311

241454

Posted

If you're using a dataset you could just loop through it and change repeating values to empty strings before you bind it to your grid. This assumes that you ORDER BY fname.

e.g

 

Dim dr As DataRow

       Dim thisrow, lastrow As String
        For Each dr In ds.Tables("yourdatatablename").Rows 
            lastrow = thisrow 'set variables to same value
            thisrow = dr.Item("fname")  'change thisrow to next  datarow in the loop
            If thisrow = lastrow Then 'if they're equal you have repeating values so...

                             dr.Item("fname") = ""
                             dr.Item("lname") = ""
                             etc...
             
           End If

 

kinda crude, but its easy.

You can not get ye flask.
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...