Linq databinding issue....data doesnt show up in gridview ...I get the message that number and name field are not found in the data source

Posted by Chandan Khatwani on Stack Overflow See other posts from Stack Overflow or by Chandan Khatwani
Published on 2011-01-08T10:50:48Z Indexed on 2011/01/08 10:53 UTC
Read the original article Hit count: 158

Filed under:
List<Emp> employees = new List<Emp>();
        Emp e1 = new Emp();
        e1.number = 2;
        e1.name = "Dinesh";
        employees.Add(e1);
        Emp e2 = new Emp();
        e2.number = 3;
        e2.name = "Vishal";
        employees.Add(e2);

        var query = from n in employees
                    orderby n.name descending
                    select n;

        GridView1.DataSource = query;
        GridView1.DataBind();

© Stack Overflow or respective owner

Related posts about LINQ