Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Building form data loically and then transferring to server help

Posted on 2013-06-02
6
Medium Priority
?
274 Views
Last Modified: 2013-06-17
Hi all,

I have a asp.net website whereby a user will build a form.

Once they have built the form I want to then save it to a db on the server.

I have created persistant classes for the tables in the db.

Now I would like to build the object as the user builds the form client side (or by AJAX?). Once the user has finished nd they click save I would like to commit to the database.

Can anyone give any advice on the best way to do this?

We have considered building persistant classes in javascript or jquery and then sending this over to the server?

Also if this is the best way to go are there any programs that will automatically build the persistant classes in javascript?

thanks in advance.

Matt.
0
Comment
Question by:flynny
  • 2
  • 2
  • 2
6 Comments
 
LVL 1

Expert Comment

by:CM2013
ID: 39214758
Just use C# to commit it to the database OnSubmit(). IS that what you are asking?
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 39214830
You could use Serialization/Deserialization for your purpose. You could save the object in to a database and as stream and you can create the objects from the stream again. In your case I hope Binary Serialization would work. As Form is as well a class you could choose this approach.

http://www.codeproject.com/Articles/36781/Serialization-and-Deserialization-in-ASP-NET-with
http://www.youtube.com/watch?v=vQZAO_BLzoU
http://www.youtube.com/watch?v=URw86vBWeGE
http://www.centerspace.net/examples/nmath/csharp/core/binary-serialization-example.php

However you could refer other serialization methods as well:

http://support.microsoft.com/kb/815813
http://www.centerspace.net/examples/nmath/csharp/core/soap-serialization-example.php
0
 

Author Comment

by:flynny
ID: 39215570
CM2013,

Thanks for this. Would the building of the form be fluid?

As I guess with this method for example when I add a section to the form (as a class), this would contact the server add it and then reload the page?

On submit button would then just read the class to the database?  

Do you have some example code on doing this please? Or is it as simple as for example adding a 'add section' button with a server side click which adds a section to the structure and html to the page?

EaswaranP

Thanks for this how would this impact search the db though? i guess witht he object serialise din the db it would be pretty impossible?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 39215731
By adding new field there is no issue. You have to update the existing data in DB accordingly.
In this case you can go for XML Serialization. Having XML data in db. If you add or remove any field then update the db column accordingly.

HTH.
0
 

Author Comment

by:flynny
ID: 39215841
Ok i see thanks for this.

Regarding transferring it across from clien to server side (preferrably ajax) how woul dyou recommend doing this pleasE?

Regards,

Matt
0
 
LVL 1

Accepted Solution

by:
CM2013 earned 2000 total points
ID: 39216602
Matt, you're quite humble :)

Did you try using Formview?

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/formview.aspx

I can post an example, let me know. There are plenty in the web as well.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question