Hi all,
I am trying to sort a dataView, but the data is still in the original order. My code is below:
Random rnd = new Random();
Links.ReadXml(Server.MapPath("Links.xml"));
Links.Tables[0].Columns.Add(new DataColumn("RandNum"));
for (int i = 0; i < Links.Tables[0].Rows.Count; i++)
{
Links.Tables[0].Rows["RandNum"] = rnd.Next(10000);
}
DataView linksView = Links.Tables[0].DefaultView;
linksView.Sort = "RandNum";
I iterrate through the Dataview and all the data is in the original order.
Can anyone please help me with this?
Thank you in advance,
Lee
I am trying to sort a dataView, but the data is still in the original order. My code is below:
Random rnd = new Random();
Links.ReadXml(Server.MapPath("Links.xml"));
Links.Tables[0].Columns.Add(new DataColumn("RandNum"));
for (int i = 0; i < Links.Tables[0].Rows.Count; i++)
{
Links.Tables[0].Rows["RandNum"] = rnd.Next(10000);
}
DataView linksView = Links.Tables[0].DefaultView;
linksView.Sort = "RandNum";
I iterrate through the Dataview and all the data is in the original order.
Can anyone please help me with this?
Thank you in advance,
Lee
Last edited: