DataView sorting

Joined
Oct 29, 2008
Messages
1
Reaction score
0
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
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top