|
You can directly serialize the Car object to JSON
like followng
return new JavaScriptSerializer().Serialize(car);
But this is the old way of doing, Now you don't need JavaScriptSerializer to serialize your object to JSON.
You can check this article, where i did something similar
ASP.NET Lazy Content Loading Through WCF REST Service[^]
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
but directly serializing the car object to jason is giving following error -
System.ArgumentException: RecursionLimit exceeded.
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)
at System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable
I will have a look at this lazy content loading article aswell.
Thank you
|
|
|
|
|
It seems that your Car class is referring itself in some way that’s why you are getting this error while serializing.
Can you share the Car class code?
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
I can mail you the class if you like as it's bit big for CP ?
|
|
|
|
|
Hi,
I need some guidance on how to store the information in a page for the specific requirement.
There are following steps involved in the process.
1) Web application A has deafult page hosting two frames a)frame for drop downs (dd.aspx) b) frame for forms (form.aspx)
2) default.aspx calls a webservice on page load.
2) webservice returns some information e.g. company name, departments, employees in each department, each employees details to Web application A.
<b>Question 1: which format the webservice should return the information . Dataset or XML or JSON</b>
3) Web application's default.aspx forms related drop down lists in dd.aspx (Frame 1)
4) When user selects company name, related dept, a specific employee from the drop down list and clicks ok
5) Second frame (form.aspx) gets the information and generates a form dynamically using this information. Here it uses some javascripts which are based on the information recieved from selected Dropdowns and used to create the data etnry form.
Question 2: <b>Should web service be sending the ready made javascripts? </b> in this case it will be huge information for each object sent .
or
Should the webapplication has code to generate the javascript based on the selected drop down lists?
<b>Question 3: How should the default.aspx or dd.aspx should store the information? Should it be session variable or viewstate? should the data be in dataset format? If the javascripts are to be stored then will it cause performance problem in storing the huge information at page level.
</b>
regards
Vijay
|
|
|
|
|
|
Hi,
I created a virtual directory and connected it to physical path.
My problem is that i recieve an error where i'm trying to access to the address.
Here is the error-
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 49: <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 50: <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 51: <add assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 52: <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 53: <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Source File: C:\www\root\AdminDailyLog\web.config Line: 51
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Can someone please help me?
Tamir
|
|
|
|
|
Looks like your webserver has not .net 3.5 framework installed. Install .net3.5 sp1 there then there should not be an error.
|
|
|
|
|
i'm not sure,
because i have applications that already running on the server.
|
|
|
|
|
treuveni wrote: i'm not sure,
You are not sure of what? How to install .NET 3.5 while other applications are running?
OR
You are trying to say that other applications that need .NET 3.5 are already running so that installation would not resolve your issue?
If it's the first one, you don't have an option other then to have a downtime and install it on server!
|
|
|
|
|
|
hi...........
I have a gridview and button.When click on button then all gridview rows inserted into database.how to do this?
please help me.....
thank u.
|
|
|
|
|
You may have a GridView but without a datasource connected to it it won't display a thing. The contents of the datasource is what you want to store in the database.
Have you even looked at examples of GridView?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thanks for reply.....
I have created datatable and that field are added into gridview.
|
|
|
|
|
Take your datatable, loop through it and insert each row into your database table then.
|
|
|
|
|
You can bind DataSet with the grid so that adapter will save all the rows on single button click.
You need not require to loop for all rows in grid. Adapter will do Bulk Insert.
|
|
|
|
|
Got that you are a beginner, but have you read anything on how grid row values can be selected and used?
Any book, tuorial? Google?
In button click event, you have to traverse row by row and insert in DB. Try first.
|
|
|
|
|
I got this error on postback the form after 20 minutes , i am using asp.net 3.5
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[CryptographicException: Padding is invalid and cannot be removed.]
....
......
[ViewStateException: Invalid viewstate.
Client IP: 122.162.81.11
Port: 50254
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
ViewState: O8yx/NB6OwGsouM4ow3.....
please any one suggest?
|
|
|
|
|
Try disabling EnableViewStateMac Property from @Page directive.
EnableViewStateMac="false"
This may work. Just a guess.
|
|
|
|
|
can you please tell me hat is the need of linq and with simple example
|
|
|
|
|
|
Use what little intelligence you have left and do this sort of thing for yourself.
I can't believe someone gave you any information at all.
|
|
|
|
|
I got an mvc application and whenever I run my page and look at the output, there's a lot of empty lines. I know it's not that important but I want my page to be as small as possible. I tried using a WhiteSpaceRemoval Http Module but it removes all the whitespaces and newlines including the necessary ones.
Thanks a lot.
|
|
|
|
|
I have declared asp.net hyperlink under the TemplateField of the Gridview. How could I find the hyperlink in the code.
Thanks
<asp:TemplateField><ItemTemplate><asp:HyperLink ID="hyperLink1" runat="server" />
</ItemTemplate></asp:TemplateField >
|
|
|
|
|
You will have to handle the RowCreated event of the Gridview.
Within this event:
Dim HyperLink As HyperLink = TryCast(e.Row.FindControl("hyperLink1"), HyperLink)
I don't use GridViews but this should get you started.
|
|
|
|