Solved

Building form data loically and then transferring to server help

Posted on 2013-06-02
6
254 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
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…

679 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