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 6140923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:10:49+00:00 2026-05-23T18:10:49+00:00

Does anyone have any suggestions on how I can take a DataSet that I

  • 0

Does anyone have any suggestions on how I can take a DataSet that I have created by parsing Excel and display it in my MVC2 website using MVCContrib’s grid?

My app lets people upload spreadsheets, review them and import the data if there are no errors.

Each spreadsheet consists of about thirty column that are required and a number of client specific fields that are defined on the server and may or may not be present in the spreadsheet. The column names will match and are predetermined.

I need to match up each column in the spreadsheet with the appropriate field in the database and present the results to the user to preview.

Any ideas on how to generate a grid to display would be appreciated.

  • 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-05-23T18:10:50+00:00Added an answer on May 23, 2026 at 6:10 pm

    It is possible by creating a custom GridModel.
    Here I based my grid on an IList filled with IDictionaries, but this should also be possible with data taken from a DataTable.
    The trick is to give the data structure to the constructor of the custom GridModel and let the custom GridModel generate columns based on the data structure.
    It is a bit ugly, but it works good.
    (and it is even uglier in VB.NET with the funny lambda expressions)

    The controller action code:

    Dim list As IList(Of IDictionary(Of String, String)) = New List(Of IDictionary(Of String, String))
    Dim row1 As IDictionary(Of String, String) = New Dictionary(Of String, String)()
    row1.Add("Column1", "ValueColumn1Row1")
    row1.Add("Column2", "ValueColumn2Row1")
    Dim row2 As IDictionary(Of String, String) = New Dictionary(Of String, String)()
    row2.Add("Column1", "ValueColumn1Row2")
    row2.Add("Column2", "ValueColumn2Row2")
    list.Add(row1)
    list.Add(row2)
    ViewData("DynamicData") = list
    

    The custom GridModel:

    Public Class DynamicGridModel
    Inherits MvcContrib.UI.Grid.GridModel(Of IDictionary(Of String, String))
    
        Public Sub New(ByVal dataToRender As IList(Of IDictionary(Of String, String)))
            If dataToRender.Count > 0 Then
                For Each name As String In dataToRender(0).Keys
                    Dim columnName As String = name
                    Column.For(Function(rowData As IDictionary(Of String, String)) rowData(columnName)).Named(columnName)
                Next
            End If
        End Sub
    
    End Class
    

    The syntax in the view:

    Html.Grid(Of IDictionary(Of String, String))("DynamicData").WithModel(New DynamicGridModel(ViewData("DynamicData")))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any suggestions for a good tool, xslt or other that can
Does anyone have any suggestions for how to create a screensaver that can cycle
Does anyone have any suggestions as to how I can clean the body of
Does anyone have any suggestions about where I can find a C# implementation for
Does anyone have any suggestions (or a regular expression) for parsing the HTTP Accept
Does anyone have any recommendations of tools that can be of assistance with moving
does anyone have any suggestions for what I can do to try and create
Does anyone have any suggestions on how to mentor a junior programmer ? If
Does anyone have any suggestions for a good approach to finding all the CPAN
Does anyone have any suggestions for creating meta tables in a database? These tables

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.