JSON String Creates The Correct Number Of Records In The Custom Objects Array?
Jul 21, 2010
For some reason the following JSON string creates the correct number of records in the custom objects array, but does NOT populate the objects in the array with and values.
[code]....
View 2 Replies
Similar Messages:
Feb 2, 2010
I'm putting together a way to cull out bad emails from my table.
I have an email field, of course, and a 'fail' field (integer)
Each time I send out an email, I get a bunch of emails back that the email addresses were undeliverable, so I'd like to (manually), enter them all into an array (or whatever), and then run a stored procedure which updates the 'fail' field by 1
I'm looking for both on the SQL side (I have an sProc that does the deed one at a time - just need the logic to do it in a batch like this), and how to do it in the web page.....
View 3 Replies
May 3, 2010
I've just upgraded to Visual Studio 2010, and notice that now when I add an event to a control (eg, "OnDataBinding" to an "ObjectDataSource", the editor no longer creates the code behind function with the right arguments etc.
How to I get this bacK?
View 1 Replies
May 2, 2010
I've build a random string generator but I'm having a problem whereby if I call the function multiple times say in a Page_Load method, the function returns the same string twice.here's the code
Public Class CustomStrings
''' <summary>'
''' Generates a Random String'
''' </summary>'
''' <param name="n">number of characters the method should generate</param>'
''' <param name="UseSpecial">should the method include special characters? IE: # ,$, !, etc.</param>'
''' <param name="SpecialOnly">should the method include only the special characters and excludes alpha numeric</param>'
''' <returns>a random string n characters long</returns>'
Public Function GenerateRandom(ByVal n As Integer, Optional ByVal UseSpecial As Boolean = True, Optional ByVal SpecialOnly As Boolean = False) As String.............
View 4 Replies
Jun 19, 2010
I'm facing very odd problem with my application. I've been developing my own custom memberhip provider (derived from MembershipProvider, of course) and everything was working smoothly, until something odd happened. In my config file, I register my provider with such code:
[Code]....
When I deploy my site, I get this error message:
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Input string was not in a correct format.
Source Error:
Line 62: <clear/>
Line 63: <add name="CustomSqlMembershipProvider"
Line 64: type="My_Membership.CustomSqlMembershipProvider"
Line 65: applicationName="My Application"
Line 66: enablePasswordRetrieval="false"
View 6 Replies
Jan 21, 2011
I use the JavaScriptSerializer class of ASP.net to serialize my object and return it to the client side. How can I deserialize the string using JavaScript?
View 4 Replies
Apr 4, 2011
In my javascript code I am getting json string from cs file
var tmpString="<%=resultset2%>";
In cs I am concatenating strings to build json string. Here is an issue the json string is returned as a string and it has " with it.
"[{id:'1',name:'Aik'},{id:'2',name:'Aik or Aik'}]"
Because of " in beginning and end javascript code treat it as a string.
View 2 Replies
Nov 16, 2010
I have Categoreis and Locations I would like return both in one method. How can make a use of both Categories.ToList() and Locations.ToList()? What type of object should I return?
View 1 Replies
Sep 13, 2010
i want to store objects in a array, that is array of objects.
View 2 Replies
Mar 17, 2010
I'm using asp.net mvc2 and trying to send a list of json objects with hard coded values from the home controller, and receive them in index.... in the code below i'm sending 1 json object. how do i send many?
in home controller:
[Code]....
View 1 Replies
May 24, 2010
I currently have a function that returns a Dataset. I would to create another function to convert the DataSet to an array of objects. I have looked around and havent found anything that can help. Can someone show me a snippet or point me to the right direction.
View 4 Replies
Jul 24, 2010
see this code:
[Code]....
While in constructor i am gettine error, Aobj(0).type is not initialized, it says that Object reference not set to an instance of an object. how to initialize my objects?
View 5 Replies
Feb 17, 2010
My brain doesn't seem to be working today. I googled around for this and just couldn't find it, which seems kind of strange since this is such a basic question that I can typically find out very quickly.
I'm trying to create an array of DateTime objects. I can't use a List.
DateTime[] dates
dates[0] = Convert.ToDateTime("12/01/2009");
dates[1] = DateTime.Now;
However, I get an error, stating use of unassigned local variable.
View 5 Replies
Apr 8, 2010
In the project I'm working on I have got a list List<Item> with objects that Is saved in a session. Session.Add("SessionName", List);
In the Controller I build a viewModel with the data from this session
[Code]....
and in my View I loop trough the list of Items and make a form for all of them to be able to remove the item.
[Code]....
When the post from the submit button is handeld the item is removed from the array and post back exactly the same viewModel (with 1 item less in the itemList).
return View("view.ascx", viewModel);
When the post is handled and the view has reloaded the value's of the html.Hidden and Html.Textbox are the value's of the removed item. The value of the html.Encode is the correct value. When i reload the page the correct values are in the fields. Both times i build the viewModel the exact same way.
View 1 Replies
Apr 15, 2010
Assume the JSON returned is
{"2010143545":{"info":[1,"soccer"]},
"2010143547":{"info":[0,"Basketball"]}
}
How do I use JQuery to render the array on ASP.NET page? More precisely, what kind of HTML template do I need to set to stuff the JSON with JQuey?
View 1 Replies
Sep 4, 2010
I'm working on an MVC2 site that needs to update the values of a select list based on the value selected by a user in another list. This is the response I'm getting from my controller's JSON action:
[{"Selected":false,"Text":"Client1Group1","Value":null},{"Selected":false,"Text":"Client1Group2","Value":null}]
View 2 Replies
Feb 24, 2010
I'm working on a project in which we have a database, data layer (entity framework), business layer and web/UI layer.I want to use ASP.NET Dynamic Data for the web layer, but don't want it to access the data layer or database, as I want it to be purely running off business logic, and not directly accessing the data.However, it appears that Dynamic Data only allows Linq-to-SQL or entity framework data sources to be used.Has anyone used it with business-layer objects instead?
View 1 Replies
Apr 21, 2010
.I am using VS2010 Ultimate in an out of the box HelloWorld MVC2 ProjectI am using JQuery 1.4.1I have the following code in my View:
function TestStringArray() {
var stringArray = new Array();
stringArray[0] = "item1";
[code]...
Forgetting my controller actually needs to return a Json result (I have a break on the return View() line), the values parameter is null. When I pass in a single string (change the type from List<String> to String in the controller, pass in a single string value from the View), it works fine. Looking at Fiddler, the array is passing the multiple values.I did some research and people are suggesting JSON.Stringify ion the JSON2 library, the JSON.NEt library, etc... Do I really need extra libraries? Microsoft didn't think of this scenario for out of the box? I assume the problem is any kind of complex type.
View 2 Replies
Feb 28, 2011
I've been trying to deserialize the following JSON output into a vb.net object:
[Code]....
The following is what i've done so far:
[Code]....
I have problems reading the array value of "t". I'm quite sure that the problem lies in the PageTags() but i'm not sure how to go from here.
View 3 Replies
Mar 23, 2010
What I'm trying to do is rather basic, but I might have my facts mixed up. I have a details page that has a custom class as it's Model. The custom class uses 2 custom objects with yet another custom object a property of one of the 2. The details page outputs a fair amount of information, but allows the user to post a comment. When the user clicks the post button, the page gets posted to a Details action that looks something like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Details(VideoDetailModel vidAndComment) { ....}
[Code]....
The only fields on the form that is posted are CommentText and VideoId. Here is what the VideoDetailModel looks like.
public class VideoDetailModel
{
public VideoDetailModel()
{
[Code]....
I suppose if I added more form fields for the properties I need, they would get posted, but I only need 1 form entry field for the CommentText. If I could get the same Model objects value that were sent to the page to post with the page, it looks like the solution is rather simple. I think using the RenderPartial in the middle of a form is problematic somehow to how the form gets written in html. I can't really put my finger on why things went bonkers, but if I do my RenderPartials before my form and then begin my form with the text entry field and the hidden VideoId, the default ModelBinder works just fine. I was beginning the form, writing the hidden VideoId, rendering several partial views, create my CommentText field, and then closed the form out. The CommentText field would get bound just fine. The hidden VideoId would not. Maybe I missed a rule somewhere about using RenderPartial.
For completeness, the partial view I was rendering took a Comment object and just wrote out it's CommentText data. Several of these objects would exist for a single Video object. All of this data was in a custom type and passed into the View (the main view) as it's Model. This partial view did not have a form and did not have any data entry fields.
View 2 Replies
Jan 25, 2011
I'm trying to add Div Objects to an array and trying to access them later when I call my loadViews function. All of my alerts fire, in the proper order, but the array m_Divs is always of length 0.
I'm re-registering the script each time on Page_Load, due to it throwing an "Error: Object expected" after each page_load when trying to call the javascript if I don't.
.JS file.
[Code]....
View 3 Replies
Jun 6, 2010
I have a gridview control that displays expenses claims received from clients. I have a template field that contains a checkbox - if this is ticked, a value from the gridview is added to a variable and this is outputted to a label control.
What I then want to do is to update the database according to which row has been ticked. I have so far the following code that adds each value to an array, which I was then hoping to access in the sql query i.e. Update table set value = value where id = (id's added to array)..
Code as follows - so far I'm just displaying the count of values in the array to make sure they are actually being added:
[Code]....
View 8 Replies
Apr 20, 2010
I am getting an error when trying to serialize an object products.
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[3,2] { {"Small","40"}, {"Medium","44"}, {"Large","50"} };
string json = JsonConvert.SerializeObject(product);//this line is throwing an error
Array was not a one-dimensional array. Is there any way to serialize a two dimensional array with Newtonsoft.json.
View 2 Replies
Mar 8, 2011
I'm using jqPlot and I need to turn this JSON which I receive from a WCF service:
[{ "x": 2, "y": 3 }, { "x": 25, "y": 34 }]
into this array or arrays:
[[2,3],[25,34]]
View 2 Replies
Jun 3, 2010
Wondering how to deserialize the following string in c#:
"[{"access_token":"thisistheaccesstoken"}]"
I know how to do it if the json was:
"{array=[{"access_token":"thisistheaccesstoken"}]}"
I'd do it like this:
public class AccessToken
{
public string access_token {get;set;}
public DateTime expires { get; set; }
}
public class TokenReturn
{
public List<AccessToken> tokens { get; set; }
}
JavaScriptSerializer ser = new JavaScriptSerializer();
TokenReturn result = ser.Deserialize<TokenReturn>(responseFromServer);
View 1 Replies