Welcome Guest Search | Active Topics | Sign In | Register

Data Populating in grid of EO.Web Options
Kabebe
Posted: Thursday, October 22, 2020 6:53:41 AM
Rank: Newbie
Groups: Member

Joined: 10/22/2020
Posts: 1
I am using the grid from EO.Web but instead of using datasourceId, I want to use the code behind to define my source of data with linq. How to do it? I am using vb.net
Thank you
eo_support
Posted: Thursday, October 22, 2020 1:05:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

For backwards compatiblity reason, EO.Web is built on top of .NET 2, not .NET 4. So it won't natively under Linq. However it is easy for you to use Linq to generate an array of more "traditional" objects and then pass that array of objects to the Grid's DataSource property:

https://www.essentialobjects.com/doc/web/grid/data_binding.aspx

For example, you can have an array of "Book" object:

Code: Visual Basic.NET
Public Class Book
    Public Property Title As String
    Public Property Publiser As String
End Class

Dim books = New Book(10) { initialize the books....}



You would then pass your books to the Grid's DataSource:

Code: Visual Basic.NET
Grid1.DataSource = books


You would then use each GridColumn's DataField property to bind each column to a property. For example, you can set the any column's DataField to "Title" in order to display the book's Title in that column.

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.