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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:05:14+00:00 2026-05-15T23:05:14+00:00

Could anyone please enlighten me about how one might go about binding to a

  • 0

Could anyone please enlighten me about how one might go about binding to a gridview in ASP.Net 4 in a scenario where the first row of my gridview should be the headers, the second should be a combobox for each column and the third is the beginning of my actual datasource.

If you can imagine what I am trying to achieve is an ability to create a binding between each column in the datagrid and another datasource. This binding is created by the user selecting a value in the comboboxes. However no matter what I try I cant seem to achieve this.

HeaderText1 | HeaderText2 | HeaderText3
ComboBox1   | ComboBox2   | ComboBox3 
DataRow1    | DataRow1    | DataRow1 
DataRow2    | DataRow2    | DataRow2 
DataRow3    | DataRow3    | DataRow3
  • 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-15T23:05:15+00:00Added an answer on May 15, 2026 at 11:05 pm

    So for anyone curious this appears to be the solution to the problem.

    Private Sub grdMainGrid_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdMainGrid.RowCreated
        If e.Row.RowType = DataControlRowType.Header Then
            For Each itm As TableCell In e.Row.Cells
                itm.Text = GenerateHeaderHTML()
            Next
        End If
    End Sub
    

    PS: If anyone has any better solutions I would love to hear them 🙂

    The following is the code I have in the GenerateHeaderHTML(). My code is a very specific case (and prob far from great). However note that you can use any html you wish.

        Private Sub grdMainGrid_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdMainGrid.RowCreated
                If Me.BoundedObjects IsNot Nothing Then
                    If e.Row.RowType = DataControlRowType.Header Then
                        Dim PrimitivePropertyNames As List(Of String) = ParserHelper.GetPrimitivePropertyNames(Me.BoundedObjects.ToList)
                        Dim i As Integer = 0
                        For Each itm As TableCell In e.Row.Cells
                            itm.Text = ucStockImport.CreateBindingHeaderTable(itm.Text, PrimitivePropertyNames, i.ToString)
                            i += 1
                        Next
                    End If
                Else
                    Throw New StockImportException("ucStockImport.BoundedObjects Is Nothing")
                End If
            End Sub
    
            Private Shared Function CreateBindingHeaderTable(ByVal HeaderText As String, ByVal PropertyNames As List(Of String), ByVal ID As String) As String
                Return String.Format("<table><tr><td>{0}</td></tr><tr><td>{1}</td></tr></table>", HeaderText, ucStockImport.CreateBindedObjectDropDownList(PropertyNames, ID))
            End Function
    
            Private Shared Function CreateBindedObjectDropDownList(ByVal PropertyNames As List(Of String), ByVal ID As String) As String
                Dim strBuilder As New StringBuilder
    
                strBuilder.Append(String.Format("<option value=""{0}"">{1}</option>", i, propName))
    
                Dim i As Integer = 0
    
                For Each propName As String In PropertyNames
                    strBuilder.Append(String.Format("<option value=""{0}"">", i) & propName & "</option>")
                    i += 1
                Next
    
                strBuilder.Append("</select>")
                Return strBuilder.ToString
            End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could anyone please tell me why the following line about filter init method invocation
Could anyone please help me convert this code to vb.net, I have tried it
Could anyone please suggest a proper format of comments I should use in a
Could anyone please explain what context should i use the AlertDialog.Builder class? I am
Could anyone please give me a heads-up on how to implement my own row
Could anyone please advise when implementing something like IComparable in .NET what sorting algorithm
Could anyone please corret me with what I'm doing wrong on scenario below? I've
Could anyone please what the following is saying about instance and object: If class
could anyone please provide on how to achieve below scenario ? 2 queues -
could anyone please clarify the meaning of line generalizes the tag object's storage of

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.