i am having a list populated from a database, i want to bind this list to a datagrid, any
assistance will be appreciated. below is my code:
public List<string> listUserNameDuplicate = new List<string>();
public List<string> listUserName = new List<string>();
while (reader.Read())
{
listUserName.Add(reader["FirstName"].ToString().ToUpper());
listUserNameDuplicate.Add(reader["LastName"].ToString().ToUpper());
listUserNameDuplicate.Add(reader["FirstName"].ToString().ToUpper());
listUserNameDuplicate.Add(reader["MiddleName"].ToString().ToUpper());
listUserNameDuplicate.Add(reader["ClassName"].ToString().ToUpper());
}
i am calling the list in this way:
listBoxDuplicate.DataSource = Wr.listUserNameDuplicate.ToList();
it displays the list items in one row only, and they are all integer values, i want to display Firstname, LastName,MiddleName,ClassName as header text in the datagrid and their
corresponding records below.
And i also want to check whether the listUserName contains more than one username.
Any assistance will be appreciated. Thanks in advance.