Problems come when i added few table styles into DataGridTableSt yle Collection and then trying to get the current TableStyle.
On first, ecxcuting this code
Then i trying to get the DataTable, on what current table style mapped to, in this code:
How can I get current TableStyle?
On first, ecxcuting this code
Code:
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";
Code:
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();
}
Comment