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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:08:00+00:00 2026-05-14T19:08:00+00:00

How do I programmatically bind data to a custom item template column for a

  • 0

How do I programmatically bind data to a custom item template column for a GridView? So far, I’ve done something similar to this:

        TemplateField foo = new TemplateField();
        foo.ItemTemplate = new bar();
        this.GridView1.Columns.Add(foo);

where bar is like this:

public class bar : ITemplate
{
    public bar()
    {

    }

    public void InstantiateIn(Control container)
    {
        DropDownList ddl = new DropDownList();
        container.Controls.Add(ddl);
    }
}

(the actual dropdownlist is populated)

But ITemplate doesn’t contain any kind of data binding properties to implement, and the TemplateField class doesn’t seem to have any either…

What do I do?


Edit: The other half is being able to handle the updates to get back to the original datasource. If I just handle the rowupdate events, I don’t see my TemplateColumn in the oldvalues/newvalues lists.

  • 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-14T19:08:01+00:00Added an answer on May 14, 2026 at 7:08 pm

    You handle the GridView.RowDataBound event.

    This explains things…
    http://www.aspnettutorials.com/tutorials/controls/dropdownlist-gridview-csharp.aspx

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

Sidebar

Related Questions

I would like to be able to programmatically bind some data to the dependency
I am trying to bind programmatically the Content property of my WPF Button to
I'm trying to add ASPxGridView to page and bind it to ObjectDataSource programmatically. here
I am trying to use databinding to bind data to a Silverlight toolkit chart.
I want to bind the contents of a HyperlinkButton to a resource programmatically, it't
I want to add a column programatically to my datagrid and bind it. I
I can bind a inner object property to gridview using the following setup at
I am updating an existing ASP .NET site. This site has a custom grid
I'm using a WPF data grid to bind to an object (i.e. not a
I'm trying to bind a List<List<string>> to a DataGrid programatically. I'm using this List<List<string>>

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.