tags:

views:

53

answers:

1

Hi there,

I've a list of values that need to be bound to a gridview programmatically as columns (not rows). For example, if my DAL returns 10 values, I need to display these 10 values as columns in a gridview as header text and have a textbox in the first row for each column as data input. I understand I need to create a class that implements the ITemplate interface and bind it to grid but I do not want to do it for each column. Is there a way I can create a generic class which implements ITemplate so I can put whatever control I want in it and bind to grid? For the last column, I need an "Add" link which will add the values entered. All of this can be done very easily declaratively but I'm struggling to get this done programmatically.

Thanks for any help.

Edit: I'm trying to do this in ASP.NET 4 and C#.