Creating web forms in runtime - asp.net

This is a question of a more general nature. I'm building a system that can create dynamically forms and reports during runtime. For that purpose we're using data dictionary for storing data and XML definitions as blueprints for creating forms and reports as needed. We're using WWF Rule Engine for necessary business logic.
Right now I'm evaluating what would be the best approach to upgrade my system to allow creating web applications from my XML definition. I'm thinking of creating master page that would have a menu of defined forms and clicking on them would render them to the user.
Web forms are different beast than win forms. What is the best approach for this?

I'd go here with ASP.NET MVC if possible - you could create the form on client side for better performance (for example using jQuery).
On the other side - you can create the forms in the View and send it to the user according to the blueprint. It's plain HTML creation.
Anyhow, if you're using ASP.NET Web forms you can iterate through the XML, interpret it and add then add to the form. It would be more complicated I think.

Related

Symfony2 Forms for API and Web

I have an existing website using a fairly "standard" Symfony full-stack, using the Form component to display and process html forms.
Now, I am creating a REST API to retrieve and manipulate our resources, and I'll use the FOSRestBundle to help with that.
I want to offer nice error messages for the forms, and FOSRestBundle ships a default way to do that. Great.
My question is: should I use the SAME form classes I used in Web? Or should I duplicate all of the forms and start from scratch?
The API will need much of the same validation as Web, but some things like Captcha and CSRF are for sure different.
Thanks for any input on this.
It's a matter of taste.
If you have very different forms then it will be easy to do new form-classes. But if you have almost the same you can use your existing forms.
In one of my projects I had different fields in forms for API and Web but I had one Form class. I just check every time: is it API or Web. And manage fields according to the type of request.

Creating SPA, using templates and ajax

I've just started with ASP.NET 4.0 Web Forms and I want to try create a really simple SPA - contacts application, the purpose is to enable the client to add / remove contacts and watch them.
So I've thought about what I need to this application, but I don't know if it exists in ASP.NET. Actually I need two templates which I can switch between them whenever I want to and manipulate data using AJAX. Additional part - I use only jQuery - not MVC framework.
My questions are:
Are there templates in Web Forms? I heard about something inside 'Ajax Control Toolkit' but I don't want to use any external code (only jQuery as external code). As I said before, I want to include in the page two templates which I can switch between them and manipulate data when I get data from the ajax requests.
While I want to remove / add / get data, where do the ajax requests go to? should I create a web service which handle this requests? are there another options?
1: No, webforms is a server/client intensive process which invalidates the whole premise of SPA where server interaction is kept to a minimum and most data is sent down on the initial request.
2: Yes any webservices can be used for SPA in Ajax.

Design decision between backbone.js or Spring MVC

I have to develop an application which takes XML reports stored in File System parse it and put it into database and display the reports by querying the database in various MIME types(XML,JSON,RSS and HTML). So what I have done till now is parsed the XML reports in the file system ,setup schema for database in MongoDB,put data in database using Spring-data and also managed to have a web service which shows rough draft of reports in XML,JSON and RSS feed.Now I want to display the reports in HTML as well and my supervisor suggested me to use Backbone.js to dispaly it in HTML format by calling the web service.Kindly advice me to choose b/w Backbone.js or write another Spring MVC web service which generates reports in HTML.
Thanks in advance
Swaraj
What you are asking are two different things and choosing between them.
You have to know what your overall objective is with the webapp is and what framework is best for it.
Short answer, Spring MVC integrates with Dojo.js right out of the box, which might do what you need to do, but since your supervisor is suggesting otherwise your options are:
Use Spring MVC to construct and display the data in the HTML using what ever render of your choice.
Or
Build out your Spring MVC wepapp API so that you can use a JavaScript MVC framework, such as Backbone.js or one of the many others (see TODOMVC for samples), to interact with your spring controllers.
Option 1 might be easy enough, used in conjunction with JavaScript or jQuery and plugins
Option 2 would be good if your webapp is complex and will be mostly a SPA (single page app) that utilizes a lot of JavaScript and you want a way to organize your js code better. See JavaScript MVC diagram for an example of how it works.

.NET ASP webpage inheritance

I am new to .NET and ideally want to make several layers of abstraction for making a fairly complex website. Being the first layer handling login, authentication, etc, with another layer handling the built in apps (how they look, predefined functions, database connections), and the lower level will be specific app implementation details.
This favors uniformity as all apps will inherit from one place allowing for easier maintenance and rapid development of all the smaller apps once the overhead abstraction layers handle their responsibilities.
The only problem is I am not 100% sure where to start with .NET ASP webpage inheritance. I tried Google and searching but I may not be looking for the right thing. I am hoping with someone with experience on the matter may direct me towards resources to make this kind of webpage inheritance/abstraction easier!
I am using Visual Studio 2010.
Edit:
I also want to add the purpose to my question: Another individual is creating the base of the website which will handle authentication, portal, UI look, etc
I want to make an app base that uses their website framework and adds onto it standards that every app must meet, function library, any addition UI overrides not applicable from portal, etc.
From there a third layer that will directly inherit from the above app base framework (abstraction) and further specify based on the guide lines made.
I appreciate the feedback so far!
In ASP.NET you have 4 common ways to reuse code/abstractions to serve you application-wide
The first way is just using a base page, which will inherit the standard asp.net Page and share the common logic for all of your pages, as explained here
The second way is using a master page: a master page defines a common design (html / css - wise) for all the pages that use it throughout the application. It can also be accessed programmatically by pages that use it, and therefore share a common logic
The third way is using an http module: An http module is basically a class, which is responsible for handling an HTTP request before its handled by the expected pages code on the server, and it allows you to add any common logic you want your application to use (such as authentication / authorization handling, getting relevant user information from the DB, etc)
Global.asax: contains application/session wide event handlers, which allow you to handle those events in once place (everything from application starting to a user session ending)
Using modules and base page is the preferred way, if you want to build few applications, sharing common behaviour. A master page can be used as well, of course, if you want them to share the same design as well.
That's quite a broad question. Welcome to ASP.NET!
I would suggest researching these topics:
Web page inheritance -> Master Pages,
Skinning -> App_Themes,
separation of responsibilities -> MVP design
pattern for the Web Forms platform, or MVC if you have a choice.
Login, roles -> Membership

How to create Data Entry User Interfaces in asp.net?

Suppose that you have a big Data Entry Web Application Like Microsoft CRM, what is the strategies and technologies that you follow to build a website like it?
I don't want to use any Dynamic Web Page Generation software, because it have a lot of limitations..
Also I don't want to design every page and repeat everything
what's the best approach?
Any Ideas or Head lines on this issue?
Thanks in Advance...
Maybe you could try frameworks such as MVC or MVP. ASP.Net Development is leading to that direction.
You can read some introduction here:
http://www.asp.net/mVC/
http://msdn.microsoft.com/en-us/magazine/cc188690.aspx
This is a really general question and is hard to provide much guidance without some specific details. Is it an Enterprise App? How will it be deployed? Do you need to provide a Web Service Interface? What sort of back end data storage are you planning on using? What sort of authentication scheme do you need? And on and on .....
Here are some general guidance from the MS Patterns and Practices Team:
Microsoft Application Architecture Guide http://msdn.microsoft.com/en-us/library/dd673617.aspx
Microsoft Patterns and Practices Developer Home
You could create your own standard format xml file that defines the index fields you wish to key during data entry. Your web app would then read this xml file for whichever document/data entry forms you wish to be working with at the time. This will allow you to dynamically read and create a form based on the fields specified within your configuration xml file for multiple forms.
Your view / UI could render the configuration file and dynamically display the data entry fields as text boxes at run-time or you could use a scaffolding application like SubSonic to generate classes / forms for you and then alter the forms to include validation and custom scripts.

Resources