Here is what I do through reflection:
View:
$(".edit").editable('<%=Url.Action("UpdateEventData","Event") %>', {
submitdata: {eventid: <%=Model.EventId %>},
tooltip: "Click to edit....",
indicator: "Saving...",
submit : "Save",
cancel : "Cancel"
});
Controller:
public string UpdateEventData(int eventid, string id, string value)
{
var evt = Repository.GetEvent(eventid);
System.Reflection.PropertyInfo pi = evt.GetType().GetProperty(id);
if (pi==null)
return "";
try
{
object newvalue = Concrete.HelperMethods.ChangeType(value, pi.PropertyType);
pi.SetValue(evt, newvalue, null);
Repository.Save();
}
catch (Exception ex)
{
}
return pi.GetValue(evt, null).ToString();
}
"HelperMethods.ChangeType" Convert.ChangeType( nullables), http://aspalliance.com/author.aspx?uId=1026.