Welcome Guest Search | Active Topics | Members | Log In | Register

Datatable to EntreeListItemDataGrid Options
aleksandarcrvc
Posted: Thursday, June 23, 2011 9:17:47 AM
Rank: Advanced Member

Joined: 6/10/2011
Posts: 37
Points: 111
Location: Belgrade
I have datatable populated with items
Code:
DataTable komTable = new DataTable();
                            komTable.Columns.Add("Komentar", typeof(string));
                            komTable.Columns.Add("Kreirao", typeof(string));
                            komTable.Columns.Add("Datum kreiranja", typeof(string));

                            foreach (var item in dsAnalystCommentLog)
                            {
                                komTable.Rows.Add(item.Comment,item.EnteredBy,item.EnteredDate);
                            }


Now I want to populate EntreeListItemDataGrid with them.

Any example,

Alex
joe
Posted: Thursday, June 23, 2011 9:31:34 AM

Rank: ME Staff

Joined: 1/12/2009
Posts: 279
Points: 408
Location: VA
I actually did one of these recently:

EntreeListItemDataGrid dg = g.AddListItem<EntreeListItemDataGrid>();

EntreeDataGridRow r = null;
EntreeDataGridCell c = null;

DataTable dt = UserData.GetUsers();

r = new EntreeDataGridRow();
r.Type = EntreeDataGridRowType.Header;

//--Create the Header row
foreach (DataColumn col in dt.Columns)
{
c = new EntreeDataGridCell();
c.Value = col.ColumnName;
r.Cells.Add(c);
}

dg.Rows.Add(r);

//--Loop through and create all rows
foreach (DataRow row in dt.Rows)
{
r = new EntreeDataGridRow();
foreach (DataColumn col in dt.Columns)
{
c = new EntreeDataGridCell();
if (col.ColumnName == "ID") c.Type = EntreeDataGridCellType.RowLabel;
c.Value = row[col.ColumnName].ToString();
r.Cells.Add(c);
}
dg.Rows.Add(r);
}
aleksandarcrvc
Posted: Friday, June 24, 2011 4:57:45 AM
Rank: Advanced Member

Joined: 6/10/2011
Posts: 37
Points: 111
Location: Belgrade
Thanks Joe,

Work like a charm.

alex
dba100
Posted: Saturday, July 02, 2011 6:32:58 PM
Rank: Member

Joined: 5/20/2011
Posts: 4
Points: 12
Location: United States
Hi Joe,
Is it possible to make cell values in the datagrid clickable? I tried a href, but it doesnt work.

thanks
joe
Posted: Monday, July 04, 2011 9:08:41 AM

Rank: ME Staff

Joined: 1/12/2009
Posts: 279
Points: 408
Location: VA
The current version of the datagrid is read-only. In order to add clickactions to the cells, you'd have to modify the XSLT (or create a new one through a theme) for the datagrid control and add that capability there

-joe
Users browsing this topic
Guest


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.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.