Solved

Building form data loically and then transferring to server help

Posted on 2013-06-02
6
214 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn how to dynamically set the form action using jQuery.
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)

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now