TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anand N
NA
19
31.4k
Bindin linq to the Gridview
Oct 10 2012 3:44 AM
Please help me to get out of this error....
I am getting error when i try to display more than one column in the griedview
protected void Button1_Click(object sender, EventArgs e)
{
//DataView dv = new DataView();
try
{
Customer1[] obj = new Customer1[2];
obj[0] = new Customer1(1, "anand", "belgaum");
obj[1] = new Customer1(1, "vijay", "kerala");
var query = from data in obj where data.Id == 1 select data;
// var query = from data in obj where data.Id == 1 select data.Name; This is working fine if i select only one column to display
GridView1.DataSource = query; // error
GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex);
}
}
public class Customer1
{
public int Id;
public string Name;
public string City;
public Customer1(int id, string name, string city)
{
Id = id;
Name = name;
City = city;
}
}
Reply
Answers (
3
)
How can i print a A4 sized document which contains both dynamic images and data?
adding float values in datagridview in c#