Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:15:45+00:00 2026-06-13T20:15:45+00:00

I created a custom GridView (actually a RadGrid ) which does roughly the following.

  • 0

I created a custom GridView (actually a RadGrid) which does roughly the following.

  1. Initialize GridView formatting
  2. Setup Columns (depending on type of data to be displayed)
  3. Populate the rows

When Instantiating this GridView, and adding it to my page, I want the first column to contain a “rowspan” attribute on the first row of repeated, but similar data. The “rowspan” value should be equal to the number of similar rows following it. In this way I hope to make the final view cleaner.

The logic for this, I figure, should take place while populating the rows. Initially I add rows to a DataTable and then bind it to the GridView as the final step.

Here’s the general logic I was attempting, but it didn’t work for me. What am I doing wrong?

Dim dt As New DataTable() 'Has three default columns
For Each d In Documents 'MAIN ITEM (First Column Data)
    Dim rowspan As Integer
    rowspan = 0
    For Each f In Files
        If rowspan = 0 Then
            Me.dt.Rows.Add(New Object() {d.Title, f.Language, f.FileSize})
            'THIS DOESN'T WORK!
            Me.dt.Columns(0).ExtendedProperties.Item("rowspan") = rowspan.ToString()
        Else
            Me.dt.Rows.Add(New Object() {Nothing, f.Language, f.FileSize})
        End If
        rowspan += 1
    Next
Next

Also keep in mind that the this is dumped into a DataView which is sorted by the first column, so I would imagine it must actually be sorted first, then somehow count the rows for each “like” first column, then set the “rowspan” value for the first row of that column equal to the number of rows belonging to it.

Does this make sense? Here is an ideal example of what I would like to accomplish in the layout:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:15:46+00:00Added an answer on June 13, 2026 at 8:15 pm

    Try this.

    Protected Sub DemoGrid_PreRender(sender As Object, e As System.EventArgs) Handles DemoGrid.PreRender
        MergeRowsWithSameContent(sender)
    End Sub
    
    Public Sub MergeRowsWithSameContent(gvw As GridView)
        For rowIndex As Integer = gvw.Rows.Count - 2 To 0 Step -1
            Dim row As GridViewRow = gvw.Rows(rowIndex)
            Dim previousRow As GridViewRow = gvw.Rows(rowIndex + 1)
    
            For i As Integer = 0 To row.Cells.Count - 1
                If row.Cells(i).Text = previousRow.Cells(i).Text Then
                    row.Cells(i).RowSpan = If(previousRow.Cells(i).RowSpan < 2, 2, previousRow.Cells(i).RowSpan + 1)
                    previousRow.Cells(i).Visible = False
                End If
            Next
        Next
    End Sub
    

    P.S: Shameless port of this wonderful code I have been using for years.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created custom adapter for listview which contain text and images, on click of
I have created custom cell in which there are n number of image views.
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I created a custom UITableViewCell subclass which contains a button named testbtn . I
I have a ObservableCollection which holds records of custom type Item. I use that
I have created one gridview and use custom adapter for that. I added two
Let's simplify this question. What I did: I created a custom Gridview I created
I have created one gridview and use custom adapter for that. I added two
I have an ASP.NET GridView which has columns that look like this: | Foo
I have make one app in which i am display data in custom gridview

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.