GridView - ObjectDataSource - Data Binding

G

Guest

I can use a GridView and ObjectDataSource to bind my data using "Eval"
expressions ... provided the GridView and related Column TemplateFields are
defined as inline HTML.

I prefer to programmatically create the GridView Column/ TemplateField
definitions at runtime.... because I do not know the number of applicable
columns until runtime. The addition of the GridView Column/ TemplateFields
work fine, however the "Eval" expressions do not result in data from the
ObjectDataSource populating the GridView.

I programmatically add the GridView Columns/ TemplateFields first and then I
issue the DataBind method for the GridView. The "Eval" expressions are
ignored.

Any suggestions ?

Thanks
 
E

Eliyahu Goldin

Philip,

Try calling the DataBind method explicitly after adding the columns.
 
G

Guest

I am already issuing the DataBind explicitly after I add the Columns.


--
Philip


Eliyahu Goldin said:
Philip,

Try calling the DataBind method explicitly after adding the columns.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Philip said:
I can use a GridView and ObjectDataSource to bind my data using "Eval"
expressions ... provided the GridView and related Column TemplateFields
are
defined as inline HTML.

I prefer to programmatically create the GridView Column/ TemplateField
definitions at runtime.... because I do not know the number of applicable
columns until runtime. The addition of the GridView Column/
TemplateFields
work fine, however the "Eval" expressions do not result in data from the
ObjectDataSource populating the GridView.

I programmatically add the GridView Columns/ TemplateFields first and then
I
issue the DataBind method for the GridView. The "Eval" expressions are
ignored.

Any suggestions ?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top