7
Answers

Linq

Photo of Pravin Ghadge

Pravin Ghadge

14y
8.7k
1

Iam using VS 2008
I want to add country in Dropdownlist.
I have used following code:
List<string> Country = GetCountryList();

var sortedCountry = from c
in Country orderby c select c;
// var sortedCountry = from c in Country orderby c select c;
ddlCountry.DataSource = sortedCountry;
ddlCountry.DataBind();
 
But iam facing error on line:var sortedCountry = from c in Country orderby c select c;
I have also used foll. namespaces:
using
System.Collections.Generic;
using
System.Globalization;
using
System.Linq;

Answers (7)