02-24-05 12:51 PM
I think i couldn't sort directly from custom properties or placeholders.
Your options is an approach i didn't think off.
Thanks.
"Mei Ying [MVP]" <anonymous@discussions.microsoft.com> wrote in message
news:1aec01c51a16$213e9780$a501280a@phx.gbl...
Hi
Not directly. You could iterate through the list of
postings and store their custom property values in a
DataTable. You can then use a DataView to sort the list in
whatever order you like.
Something like this:
PostingCollection pc = c.Postings;
//put information about the postings in a table
DataTable dt = new DataTable();
dt.Columns.Add("Name",System.Type.GetType
("System.String"));
dt.Columns.Add("PromotionStartDate",System.Type.GetType
("System.DateTime"));
DataRow newRow;
for (int i=0; i<pc.Count; i++)
{
//add a new row to the table for each posting in
the list
newRow = dt.NewRow();
//add the name
newRow["Name"] = pc[i].Name;
//add the date
newRow["PromotionStartDate"] = DateTime.Parse(pc
[i].CustomProperties["PromoDate"].Value);
//add the new row to the table
dt.Rows.Add(newRow);
}
//bind the table to the datagrid
DataView dv = dt.DefaultView;
dv.Sort = "PromotionStartDate desc";
myDataGrid.DataSource = dv;
myDataGrid.DataBind();
regards
Mei Ying
---
Blog: http://meiyinglim.blogspot.com
Book: http://www.packtpub.com/book/mcms
Contact: meiyinglim@hotmail.com
---
>-----Original Message-----
>I have a custom property that as a date value and i wan't
to sort postings
>using that property.
>Is possible to order a list of postings using a custom
property?
>
>thanks,
>Gonçalo Boléo
>
>
>.
>
[ Post a follow-up to this message ]
|