CODE
var searchid = textBox1.Text.Trim();
var quer = (from p in std.student
where p.StudId.Text.ToString(quer)
select p).Count();
dataGrid1.ItemsSource = quer;
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Dec 13, 2013, 6:04 AM
ItemsSource property of any control is type of IEnumerable, so accept only those value.
here you are trying to assign int value to ItemsSource property...
var searchid = Convert.Toint32(textBox1.Text.Trim());
var quer = (from p in std.student
where p.StudId == searchid
select p);
dataGrid1.ItemsSource = quer;
hope this will help you.
Sanjay KumarPosted Dec 13, 2013, 2:30 AM
http://stackoverflow.com/questions/3853010/get-item-count-of-a-list-using-linq
http://stackoverflow.com/questions/14865099/with-linq-get-count-of-items-that-satisfy-criteria-in-grouping
Biswa Pujarini MohapatraPosted Dec 13, 2013, 2:14 AM
var searchid = textBox1.Text.Trim();
Please let me know if you are expecting anything else.
Sanjay KumarPosted Dec 13, 2013, 2:09 AM
var searchid = Convert.ToInt32(textBox1.Text.Trim());