Seven price
asked on
Jquery array receive deserializing error
hi, well i am pretty familar with Serialization but not for c# for deserializing.
from my link to jfiddle I am passing the values to the server side.
On the server side I am trying to take the values and submit them to a server
Not totally sure of the syntax but it would be so appreciated.
from my link to jfiddle I am passing the values to the server side.
On the server side I am trying to take the values and submit them to a server
public static string CheckExists(string Threshold, int sec) //Method should be declared as static
{
DataContext db = new DataContext();
Clear aTransaction = new Clear();
List<IaTransaction> Threshold = JsonConvert.DeserializeObject<List<aTransaction>>();
try
{
foreach (var grds in Threshold)
{
aTransaction.APTransactionSecurityTypeID = sec;
aTransaction.Threshold = sec;
db.ClientPreClears.InsertOnSubmit(aTransaction);
db.SubmitChanges();
}
}
catch (Exception ex)
{
}
return JsonConvert.SerializeObject(Threshold);
}
Not totally sure of the syntax but it would be so appreciated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What kind of web project is this? MVC? Web Forms?
ASKER
web Forms 3.5 frameworks
asp.net
asp.net
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the button like in the example but it will be a button control.<asp:button runat=server id=btn />
ASKER
if you look at the jfiddle example it will invoke on post.
OK, but how are you getting the data from the AJAX POST into that method (on the server)?
ASKER
this I think is a good example.
http://stackoverflow.com/q uestions/9 707139/c-s harp-asp-n et-3-5-des erialize-j son-how-to -get-each- object-str ing
http://stackoverflow.com/q
ASKER
data = @"[{""ShiftID"":""2"",""EmpName"":""dsdsfs""},{""ShiftID"":""4"",""EmpName"":""dsdsfd""}]";
ar values = JsonConvert.DeserializeObject<Dictionary<string, string>[]>(data);
Ok since I am getting a lot of questions with questions. I have a simple question. see where it says data in my jfiddle code how can I get data to look like the above when sending my data. data is called when Deserializobject.
string>[]>(data);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
But I use the jfiddle example to show how I am getting data. if you just try the jfiddle example it will do a popup showing you the objects. passing to a var data it my biggest problem.
http://jsfiddle.net/Nbr7Y/ 6/
now you have var data with the values static, how can I get my json data to the server side
Instead of
2","1","3" ],"sec":[" 3","32","2 ","1","3"] }
how can I get each object from this example
http://jsfiddle.net/Nbr7Y/
now you have var data with the values static, how can I get my json data to the server side
Instead of
var data = @"[{""ShiftID"":""2"",""EmpName"":""dsdsfs""},{""ShiftID"":""4"",""EmpName"":""dsdsfd""}]";
I want {"Threshold":["343","32","how can I get each object from this example
ASKER
i figured it out.
ASKER