neizodiescers
New Member
I have a grid view that connect to the DataSqlSource. I want to sort my queries dynamically by a dropdownlist. for example by date,name,family etc.I also join some tables in my queries.I use this code in my DataSqlSource:\[code\] SELECT AddTitle.Title, SubmitManuscript.Status, AddArticleType.Type, AddArticleType.UserName, AddArticleType.ArticleType, SubmitManuscript.date, SubmitManuscript.ArticleNum, AddArticleType.ArticleID, CONVERT (VARCHAR(10), SubmitManuscript.date, 103) AS date1, OtherWritter.ArticleID AS Expr1, OtherWritter.name, OtherWritter.family, AddArticleType.CheckFinish FROM AddArticleType INNER JOIN AddTitle ON AddArticleType.ArticleID = AddTitle.ArticleID INNER JOIN SubmitManuscript ON AddArticleType.ArticleID = SubmitManuscript.ArticleID INNER JOIN OtherWritter ON AddTitle.ArticleID = OtherWritter.ArticleID WHERE (AddArticleType.ArticleID IN (SELECT ArticleID FROM AddUpload_4 AS AddUpload_4_1 WHERE (AddArticleType.CheckFinish = '0'))) AND (AddArticleType.Type = @Type) AND (SubmitManuscript.Status = 'Accept') AND (OtherWritter.MainAuthor = 'Yes') ORDER BY '[' + @SortOrder + ']' DESC\[/code\]but it doesn't work for me and no sorting happen!And I also try this code, this time it gave me an error:here is the code:\[code\]SELECT ...FROM ...ORDER BY CASE WHEN @order=Country THEN Country END DESC, CASE WHEN @order= City THEN City END ASC, CASE WHEN @order= name THEN name END ASC\[/code\]Can any body help me?