ObjectDataSource, GridView and ItemTemplate

  • Thread starter Mogens Nielsen - Elbek & Vejrup A/S
  • Start date
M

Mogens Nielsen - Elbek & Vejrup A/S

Hi all,
I'm currently experimenting with the all new GridView. I have made an
objectDataSource bound to one of my business entities.
In the presentation layer I now wish to use the GridView and make an
ItemTemplate. However I can't seem to find out how to access the properties
of my object in the template. Eval-function doesn't seem to work with
object-binding.
Has anyone made an itemtemplate for the gridview using object binding ??

Thanks in advance...
Mogens Nielsen
Elbek & Vejrup A/S
 
M

Mogens Nielsen - Elbek & Vejrup A/S

Nice samples, however my problem is that when binding a list of custom
objects to the gridview, I can't seem to bind to the properties of the bound
objects in the ItemTemplateField. I would like to use the Bind or Eval
methods, but those are restricted for data-objects only - as far as I see
it...

Hope anyone has further response...

TIA,
Mogens Nielsen
Elbek & Vejrup A/S
 
P

Phillip Williams

If you look carefully at this sample
http://www.webswapp.com/codesamples/aspnet20/dropdownlist_gridview/default.aspx

You will see that it is using a class named clsOrder (whose source code is
listed). The class has several public properties all of which are bound to
the GridView using either Bind or Eval.

The use of the ObjectDataSource is what makes this possible.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/57hkzhy5(VS.80).aspx
 
M

Mogens Nielsen - Elbek & Vejrup A/S

Hi Phillip,
thanks for pointing me in the right direction. Sorry that I didn't got it at
first...
I got it all working now. It seems that the Bind method must be used within
a server control's property, which I didn't realize before now.

Mogens Nielsen
Elbek & Vejrup A/S
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top