views:

25

answers:

0

I have an <asp:gridview> that is being populated with a data table. There are currently two columns one is title. This column sorts correctly until when I am building a link to go to the title of the article the grid starts sorting by the URL. So if the title is Zebra and the articleid is 5 then I have a title named Antelope with an articleid of 6 then my list when sorted ascending comes up with the Zebra first since it's sorting the URL.

My code when adding data to the data table looks like the below in example 1. Example 2 would sort correctly though but I need the title's to be links though. Any help would be appreciated.

Example 1

string URL = string.Format("<a href=\"/articles/article.aspx?id={0}\">{1}</a>", article.ID, article.Author);

dt.Rows.Add(URL, article.Author);

Example 2

string URL = string.Format(article.ID, article.Author);

dt.Rows.Add(URL, article.Author);