asp.net - How to Read System.GUID on C# -
here's controller action
[httpget] public jsonresult getordernum(string input) { aentities db = new aentities(); var result = r in db.orders r.trackingnumber.tostring() == input select new { r.status, }; return json(result, jsonrequestbehavior.allowget); }
and here make ajax call
var myactionurl = '@url.action("gettrackingnumber", "acustomer")'; var trackinginfo = $('#trackingnumber').val(); $('.track').click(function () { $.ajax({ type: "get", url: myactionurl, data: $('#trackingnumber').val(), contenttype: "application/json; charset=utf-8", datatype: "json", success: function (json) { alert("response js object: " + json); console.log(json); } });
the problem wont read r.trackingnumber.tostring()
system.guid
. idea how can resolve this?
at moment when run it, empty array "[]"
.
there number of different ways guid can represented string.
system.guid.tostring() provides overload format specifier. select format specifier matches format of guid found in input
.
update
'system.string tostring()' method, , method cannot translated store expression
you need instead create guid input
:
guid inputguid = guid.parse(input); var result = r in db.orders r.trackingnumber == inputguid select new { r.status, };
Comments
Post a Comment