I have a RadGrid with batchedit mode in a usercontrol, and I want to have different editors based on the type of the parameter. For example : if the parameter is a string, the editor should allow to write strings, or datetime, boolean, integer, even files so the user can download the file and also images so they can appear on the radgrid !
I found something similar to what I want but it's using Kendo UI : https://docs.telerik.com/kendo-ui/knowledge-base/grid-different-editor-based-on-column-value
Any suggestions ?
5 Answers, 1 is accepted
You can achieve the target behavior utilizing the EditForm Template functionality of RadGrid. A live demo demonstrating this can be found here:
The problem is that I am using BatchEdit RadGrid : https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx. And it is actually my user control, so I don't really know how I can use the EditForm Template depending on my "Type" of my object parameter.
I'll show you an image so it can be more clear. I'm trying to have exactly the same comportment in the link that I sent in my first post !
In my picture : The parameter "Integer" should allow user to enter only numeric numbers, the "string" one should allow to write exactly only strings and so on for other types..
Thank you !
The behavior shown in the link is actually the default behavior of the Batch edit mode of the Grid - each column is edited depending on its DataType. You can test this behavior in our online demos as well:
In case the default behavior of the Grid does not fit your needs, you can handle the Gird's CreateColumnEditor event and set the desired Editor type manually in it. You can find useful information on this matter here:
Thanks for your answer, the behavior I need is more something like CreateRowEditor, because the value column is related to the type of the item (parameter). And I need to load the editor of the row based on this type. It's like exactly what I showed with the link of kendo UI. But I need it in AJAX UI.
Thank you !
The sample in the linked article is using the column DataField in order to identify the column which editor to change, but you can access the DataType of the column through the same e.column object: