Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Unable to bind DataGridView
Harsh Jani
Jan 27 2015 12:33 AM
645
Reply
Hi,
I am creating a Windows Application. I am unable to Bind DataGridView. I am using the following code to bind DataGrid. The code does not show any error but every time I try to bind DataGrid, it does not display any value.
private void BindGridView()
{
List<OrganizationType> ListAllOrganizationType = obj_OrganizationType.SelectAll();
string OrganizationNameSearch = cmb_OrganizationTypeName.Text.ToString().ToLower();
var ListOrganzaitionType = (List<OrganizationType>)(from OrgType in ListAllOrganizationType where (OrganizationNameSearch == string.Empty ? true : (OrgType.TypeName.ToLower().Contains(OrganizationNameSearch))) select OrgType).ToList();
if (ListOrganzaitionType.Count > 0)
{
gv_OrganizationType.DataSource = new List<OrganizationType>(ListOrganzaitionType);
}
else
{
MessageBox.Show("No Records Found", "Alert");
}
}
Kindly let me know what is the error in the above code.
Thank you.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Timer Control.
User controls in windows application.