Hi,
I am using IgniteUI 15.2 igcombo Jquery controls and my sample code is below. I use Id column as ValueKey and Name column as TextKey. I have also enabled AllowCustomValue = true to allow user defined value and pass to MVC controller (bind to Model)
$('#testList').igCombo({ mode: "editable", dataSource: _testList, selectedItems: [ { value: "@Model.SelectedId" } ], initialSelectedItems: [ { value: "@Model.SelectedId" } ], textKey: "TestName", valueKey: "TestId", allowCustomValue: true, width: "375px", });
Is there a way to pass the custom value (There is no id since user added this entry) that was added and selected back to MVC controller in my scenario where i have id column as a valuekey?
If yes, please attach some sample project.
Thanks,
Valliappan
Hello Valliappan,
As for your first code issue the resolve would be to submit the custom value via an Ajax call and handle it on the server.
For example
$.ajax({
traditional: true,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
type: "POST",
data: {key: },
url: "<Path/To/Controller>",
success: function(data) {},
failure: function(response) {},
error: function(data) {}
});
As for your second issue could you provide some mock data in order to check the igCombo initialization.
Just to give you some context. As of now we are using both textKey and ValueKey as "Name" column but i am running into the below issue
igcombo can't initialize the selectedItem on load if my data has a double quotes/apostrophe/any other special characters
Ex: "15" monitor" or "Laptop's Name" so i was thinking of using valueKey as "Id" column and hence my 1st post
In both options, i have some roadblocks. Please recommend.