I am binding a DataTable to RadGridView and AutoGenerateColumns="True",
Following are the columns I have,
dt.Columns.Add("Text", typeof(string));
dt.Columns.Add("Number", typeof(double));
dt.Columns.Add("CustomType", typeof(Custom));
Custom is a Enum as follows,
public enum Custom
{
One,
Two,
Three
}
Now when I bind the DataTable to RadGridView it displays Data correnctly, but when I try to change the value of custom columns I am not getting dropdown to select a value from Enum instead when I enter in edit mode it displays the Id of the selected Enum.
I tried changing RadGridViewDataColumn to RadGridViewComboBoxColumn in AutoGeraratingColumns Event but not able to make it working.
Please help as its pretty urgent and important.
Attached is the screenshot for the same.
Thanks in Advance!!!
Following are the columns I have,
dt.Columns.Add("Text", typeof(string));
dt.Columns.Add("Number", typeof(double));
dt.Columns.Add("CustomType", typeof(Custom));
Custom is a Enum as follows,
public enum Custom
{
One,
Two,
Three
}
Now when I bind the DataTable to RadGridView it displays Data correnctly, but when I try to change the value of custom columns I am not getting dropdown to select a value from Enum instead when I enter in edit mode it displays the Id of the selected Enum.
I tried changing RadGridViewDataColumn to RadGridViewComboBoxColumn in AutoGeraratingColumns Event but not able to make it working.
Please help as its pretty urgent and important.
Attached is the screenshot for the same.
Thanks in Advance!!!
6 Answers, 1 is accepted
0
Hi,
I prepared a sample project for you that illustrates how to handle this scenario. You can find it attached.
Regards,
Ivan Ivanov
Telerik
I prepared a sample project for you that illustrates how to handle this scenario. You can find it attached.
Regards,
Ivan Ivanov
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Swapnil
Top achievements
Rank 1
answered on 16 Sep 2015, 07:06 AM
Hi Ivan,
Thanks for the quick reply.
The attached project has collection of model but our requirement is such that we have to use datatable. Can you please help me out by using datatable instead of Collection.
0
Accepted
Hello,
Indeed the scenario with DataTable is a bit different, as DataRows do not contain the concrete enum value, but the underlying declaration value (e.x. int). I am attaching a slightly modified version of my initial project.
Regards,
Ivan Ivanov
Telerik
Indeed the scenario with DataTable is a bit different, as DataRows do not contain the concrete enum value, but the underlying declaration value (e.x. int). I am attaching a slightly modified version of my initial project.
Regards,
Ivan Ivanov
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Swapnil
Top achievements
Rank 1
answered on 18 Sep 2015, 01:39 PM
Perfect Thank you very much !!!
0
Swapnil
Top achievements
Rank 1
answered on 28 Sep 2015, 09:42 AM
Hi Ivan,
Everything works well with the solution you have provided but am facing issue with filtering.Can you please have a look at the attached screenshot of the solution you have provided.
Thanks
0
Hello,
RadGridView cannot resolve the proper filtering values as the declaratin type of the DataTable column is Position, but it really contains numeric values. You can set the column's DataType to be int, which is the actual type of the bound values. Then the distinct value will be loaded as numerics. If you want to modify the way in which they are displayed, you can modify RadGridVIew FilteringControl's template.
Regards,
Ivan Ivanov
Telerik
RadGridView cannot resolve the proper filtering values as the declaratin type of the DataTable column is Position, but it really contains numeric values. You can set the column's DataType to be int, which is the actual type of the bound values. Then the distinct value will be loaded as numerics. If you want to modify the way in which they are displayed, you can modify RadGridVIew FilteringControl's template.
Regards,
Ivan Ivanov
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items