|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ObjectDataSource, GridView and ItemTemplateHi 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
http://www.webswapp.com/codesamples/aspnet20/dependentlists/gridview.aspx
http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspx http://www.webswapp.com/codesamples/aspnet20/gridview_multiplerows_selection/default.aspx Show quote Hide quote "Mogens Nielsen - Elbek & Vejrup A/S" wrote:
> 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 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 Show quoteHide quote "Phillip Williams" wrote: > http://www.webswapp.com/codesamples/aspnet20/dependentlists/gridview.aspx > http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx > http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspx > http://www.webswapp.com/codesamples/aspnet20/gridview_multiplerows_selection/default.aspx > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Mogens Nielsen - Elbek & Vejrup A/S" wrote: > > > 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 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 Show quoteHide quote "Mogens Nielsen - Elbek & Vejrup A/S" wrote: > 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 > > "Phillip Williams" wrote: > > > http://www.webswapp.com/codesamples/aspnet20/dependentlists/gridview.aspx > > http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx > > http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspx > > http://www.webswapp.com/codesamples/aspnet20/gridview_multiplerows_selection/default.aspx > > -- > > HTH, > > Phillip Williams > > http://www.societopia.net > > http://www.webswapp.com > > > > > > "Mogens Nielsen - Elbek & Vejrup A/S" wrote: > > > > > 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 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 Show quoteHide quote "Phillip Williams" wrote: > 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 > > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Mogens Nielsen - Elbek & Vejrup A/S" wrote: > > > 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 > > > > "Phillip Williams" wrote: > > > > > http://www.webswapp.com/codesamples/aspnet20/dependentlists/gridview.aspx > > > http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx > > > http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspx > > > http://www.webswapp.com/codesamples/aspnet20/gridview_multiplerows_selection/default.aspx > > > -- > > > HTH, > > > Phillip Williams > > > http://www.societopia.net > > > http://www.webswapp.com > > > > > > > > > "Mogens Nielsen - Elbek & Vejrup A/S" wrote: > > > > > > > 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
pop-up browser persist data back to parent page code-behind
How to add client script to a pushbutton in datagrid How do change layout od SideBar in Wizard control? (ASP.NET 2.0) FileUpload - keep the filename WebPart and WebPartZones Usage NullReferenceException With Different Register Directive Navigation Menu Site Map Difficulties Access property and control of master page from a customized parent page class Alignment of webcontrols... AccessibleHeaderText property |
|||||||||||||||||||||||