object st = Args.SortExpression.GetType().name;
public void Sort_Grid(object Src, DataGridSortCommandEventArgs Args) { // Here i like to get the selected column data type.. like args.sortexpression.gettype(); Type t = null; ; foreach (DataGridViewColumn dc in dgvMappedData.Columns) { if (dc.Name == Args.SortExpression) t = dc.ValueType; } switch (t) { case typeof(string): // TODO your code goes here break; default: break; } }
Type t = Args.SortExpression.GetType();
*.GetType().Name
dgvMappedData.Columns.Cast<DataGridViewColumn>().ToList().Find(dc =>dc.Name == Args.SortExpression).ValueType
Type t = dgvMappedData.Columns.Cast<datagridviewcolumn>().ToList().Find( delegate(DataGridViewColumn dc) { return dc.Name == "Name"; } ).ValueType; </datagridviewcolumn>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)