Atlantis11500
September 26th, 2006, 03:45 AM
For example, I have a couple of Student records and want to show them by a DataGrid.
Student:
DWORD ID;
string strName;
string strAddress,
string strEmail.
So, I create a List of Students and bind it with a DataGrid as follows.
//Create a list of Students.
IList students = new ArryList();
students.add(new Student(1, "steven"......));
student.add(new Student(2, "Tom"......));
......
//Bind DataGrid to these data source.
myDataGrid.DataSource = students;
Now, I can get a DataGrid which has four columns...say, ID, Name, Email, Address... but, however, what I need to do is to customize these columns, for example, I only want to show two columns, Name and Email...or,even i want to show the Email column before/after Name...or somthing else.
What should I do? Must I inherite from the DataGrid and rewrite my own DataGrid?
Student:
DWORD ID;
string strName;
string strAddress,
string strEmail.
So, I create a List of Students and bind it with a DataGrid as follows.
//Create a list of Students.
IList students = new ArryList();
students.add(new Student(1, "steven"......));
student.add(new Student(2, "Tom"......));
......
//Bind DataGrid to these data source.
myDataGrid.DataSource = students;
Now, I can get a DataGrid which has four columns...say, ID, Name, Email, Address... but, however, what I need to do is to customize these columns, for example, I only want to show two columns, Name and Email...or,even i want to show the Email column before/after Name...or somthing else.
What should I do? Must I inherite from the DataGrid and rewrite my own DataGrid?