Welcome Guest Search | Active Topics | Sign In | Register

Evaluating eo.Web Grid Options
MAB
Posted: Friday, July 11, 2008 9:53:01 AM
Rank: Newbie
Groups: Member

Joined: 3/24/2008
Posts: 8
I am in the process of evaluating you web components:

I have tried the Tab Strip and am satisfied that it will handle our needs.

I am trying to replace the Standatd MS.Net Grid with your grid component and I am not able to populate the grid. I am attaching the code that is being executed.
The data is being retrieved via a webService that returns a DataSet (ds)
gCusipList is the MS.Net Grid
eogCusipList is the eo.WebGrid.

wsSPrtg.spRating wsRating = new wsSPrtg.spRating();
DataSet ds = wsRating.GetCusipList(ListFKID);
gCusipList.DataSource = ds.Tables["CusipList"].DefaultView;
gCusipList.DataBind();
eogCusipList.DataSource = ds;
eogCusipList.RecordCount = ds.Tables["CusipList"].Rows.Count;
eogCusipList.DataBind();

Results:
The MS.Net Grid is populated and displays correctly
the eo.Grid has the correct number of rows but no data is displayed.

Thanks iin advance.

Mike Braganca
eo_support
Posted: Friday, July 11, 2008 10:23:07 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi Mike,

Thank you very much for posting in the forum. One of the biggest difference between MS Grid and our Grid is that with our Grid you must explicitly defines the columns, while MS Grid can automatically populates the columns from the DataSource. Our Grid requires you to explicitly define the column because it can do more than just static text. For example, with a simple Date field, our Grid can show either a DateTimeColumn or a StaticColumn.

In order to define columns, you would right click the Grid, then choose "Edit Grid...", then go to "Columns" and you will be able to add or remove columns there. Two things are most important for each column: One is the column type; the other is the column's "DataField", which is the field name in your data set that this column is associated with.

You can find more information on how to define columns at here:

http://www.essentialobjects.com/ViewDoc.aspx?t=Grid%2fcolumns.html

We are also thinking about support AutoGenerateColumns just like MS Grid. In that case every column will be a StaticColumn. If your situation requires that, we should have no problem to provide the code that automatically generates the columns from your datasource before this feature is fully implemented.

Please let us know if this is the problem. We will be happy to help if you have any more questions.

Thanks
MAB
Posted: Friday, July 11, 2008 10:33:06 AM
Rank: Newbie
Groups: Member

Joined: 3/24/2008
Posts: 8
Thanks for the quick response.

I tried defining a single column and that works.

Since I am retrieving the data via a webService and the returned columns are unknow until run time, can I programatically define the colums based on the data that is returned?

Thanks.
eo_support
Posted: Friday, July 11, 2008 10:44:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Absolutely. You can use the following code to do so:

Code: C#
//Get the DataTable object
DataTable table = ds.Tables["CusipList"];

//Clear existing columns
eogCusipList.Columns.Clear();

//Optional: Add a row number column
eogCusipList.Columns.Add(new EO.Web.RowNumberColumn());

//Add a new Grid column for each data column in
//your data source
foreach (DataColumn column in table.Columns)
{
    EO.Web.StaticColumn gridColumn = new EO.Web.StaticColumn();
    gridColumn.DataField = column.ColumnName;
    eogCusipList.Columns.Add(gridColumn);
}

//Data bind
eogCusipList.DataSource = table;
eogCusipList.RecordCount = table.Rows.Count;
eogCusipList.DataBind();


Please let us know if this works for you.

Thanks!
MAB
Posted: Friday, July 11, 2008 12:06:04 PM
Rank: Newbie
Groups: Member

Joined: 3/24/2008
Posts: 8
This works fine...

I added the following to set the header text:

gridColumn.HeaderText = column.ColumnName.ToString();

Thanks.
eo_support
Posted: Friday, July 11, 2008 12:14:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Awesome! Thanks for sharing! The HeaderText is indeed very important.

Please feel free to let us know if you have any more questions.


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.