0

i have a java script dictionary. its dictionary<string,dictionary<string,string>> if it is helpfull. i cant pass it to controller class using jquery ,ajax is ther any way to do that?

<script language="javascript" type="text/javascript">
 var dictionary = {};
  var props = {};
props["test1"]="test1";
props["test2"]="test2";
props["test3"]="test3";
dictionary["test"]=props;

function SaveForm() {
 $.ajax({
     type: 'POST',
     url: '/Home/SaveForm',
     data: { formName: $('#formName').val(),  dics: dictionary },
     //contentType: 'application/json'
     dataType: 'json'

 });
}


</script>


public void SaveForm(  Dictionary<string,<string,string>>dics)===> dics is null always
deceze
  • 510,633
  • 85
  • 743
  • 889
adrakadabra
  • 413
  • 2
  • 5
  • 12
  • Some useful pointers here: [How do I pass a Dictionary as a parameter to an ActionResult method from jQuery/Ajax?](http://stackoverflow.com/questions/1077481/how-do-i-pass-a-dictionary-as-a-parameter-to-an-actionresult-method-from-jquery-a) – Chris Fulstow Aug 18 '10 at 05:00
  • i used it but by this line bindingContext.Model = new JsonDictionary() in public class JsonDictionaryModelBinder : IModelBinder { #region IModelBinder Members public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { if (bindingContext.Model == null) { bindingContext.Model = new JsonDictionary(); } i will face with this error This property setter is obsolete, because its value is derived from ModelMetadata.Model now. – adrakadabra Aug 18 '10 at 05:09
  • Try here for tweaks to get it working in MVC2 - http://stackoverflow.com/questions/1531776/this-property-setter-is-obsolete-because-its-value-is-derived-from-modelmetadat – Chris Fulstow Aug 18 '10 at 05:24

0 Answers0