On first, ecxcuting this code
Expand|Select|Wrap|Line Numbers
- dgEmployees.DataSource = null; //DataGrid
- dgProjects.DataSource = null;
- dgEmployees.DataSource = DS;
- dgProjects.DataSource = DS;
- dgEmployees.TableStyles.Clear();
- int E_index = dgEmployees.TableStyles.Add(new DataGridTableStyle());
- dgEmployees.TableStyles[E_index].MappingName = "EmployeeTable";
- dgProjects.TableStyles.Clear();
- int P_index = dgProjects.TableStyles.Add(new DataGridTableStyle());
- dgProjects.TableStyles[P_index].MappingName = "ProjectTable";
Expand|Select|Wrap|Line Numbers
- try
- {
- if (Table.TableStyles.Count > 0)
- {
- System.Collections.IEnumerator MuEnum = Table.TableStyles.GetEnumerator();
- MappingName = ((DataGridTableStyle)MuEnum.Current).MappingName;
- }
- else
- MappingName = "No table Styles";
- }
- catch(Exception err)
- {
- MappingName = "Unknown - errors at trying to use table styles.\n" + err.Message +
- "\nStyles in table - " + dgEmployees.TableStyles.Count.ToString();
- }