0
check the target framework your project using.
if its 3.0 then change to 3.5 and complie the code.
Accepted 0
I tested your code; it works for me, therefore it is likely the code that precedes the LINQ statement has an error. The errors are saying that a semicolon is missing, so I would look at the code preceding the LINQ.
0
This code should work. Manikavellu is correct.
IList<string> _country = new List<string>();
_country.Add("India");
_country.Add("US");
_country.Add("China");
_country.Add("Zimbabwe");
var query = from c in _country
orderby c
select c;
DropDownList1.DataSource = query;
DropDownList1.DataBind();
0
There are 6 errors:
Error 2 ; expected
Error 3 ; expected
Error 4 Invalid expression term 'in'
Error 5 ; expected
Error 6 ; expected
Error 7 ; expected
on line:
var sortedCountry = from c in Country orderby c select c;
0
0
Below code works fine, just try this;
List<string> s = new List<string>();
s.Add("Manik");
s.Add("Babu");
s.Add("Velu");
var s1 = from s2 in s orderby s2 select s2;
DropDownList1.DataSource = s1;
DropDownList1.DataBind();
0
Can you paste the error ?, It will be easier to provide the solution by seeing the exact error.