C# web forms api to dynamically create forms - c#

I am working on an asp.net project which has numerous form screens. All our forms are pretty much using a given set layout which needs to be made by developers ond an on again.
Our current implementation requires that for every form control, a developers needs to write inside in the .aspx file the HTML of our forms (whilst embedding our field controls in them).
As a result, we have our project's HTML code scattered in many, many controls all over the place. It is highly possible that we change the HTML of our forms in the future.
Does asp.net C# have anything similar to Drupal's Form API which allows developers to simply create their forms programatically using a "Form Control" of some sort? The developer would add 'rows' with different field controls in them. It is then upto the 'Form Control' to generate the HTML structure of the form in the end.
Using such a method should give me the following benefits:
HTML is all in one place - making it easy to change and even skin differently
Developers who are not HTML+CSS savvy do not need to tinker out of their comfort zone
Fast development of new forms
I had a look online and it looks to me that maybe what I am after is a Hybrid Table Control that is modified to generate Div's (and not necessarily table tags).
Any ideas?

I would:
create a master page for the whole web application
create a nested master page for the pages where these data controls appear
put all necessary CSS, html etc in these master pages
create a 'template control' for developers to follow, where they just need to drop items onto a new control.

Related

How do I pass data to a layout which provides common controls for various pages

I am currently developing an ASP.Net project which provides a layout containing a lot of controls which should be rendered on every page the user visits. For example, a friends list should always be shown on the right of a page, as facebook uses for example.
Considering I want to avoid code reuse, I was planning to move the whole control to a shared page, which every other site is being rendered into.
However, I am now standing in front of the question how to get all the data from my backend to this control.
I read up a little bit and found out that I could use a model in the layout as well, but considering that this might not be the only control which might need data from a model, this model could grow big quickly and I would constraint myself to use a base model for any other model I will ever use in that project, as every page would need the required data for the controls in my shared view.
How could I deal with this? Is there a way to pass data to common controls in a shared page without a lot of downsides?
Or better, did I miss some other way to implement this, which would make everything easier for me?

Replicate ASP.NET Control/Functionality over pages with a single control

I got multiple pages (not all) with the same functionality (a control for send Contact info) even for Dekstop and Mobile websites.
I want to create just one control and declare it as something like: "<asp:MySendInfo />" wherever I want to display all the TextBoxes, Lables, load events, etc, etc; that compose the hole functionality.
I can't use iframes or a masterpage.
As a comment from Yuriy above says, you are looking for User Controls (they usually have an .ascx extension). They work pretty much the same as ASP.NET Pages (.aspx).
For a quick start this is how you add them to your project and how you register and call them in your page.

Creating a desktop application to design Master Page?

How would I go about creating a desktop application that would be capable of generating an ASP.NET master page, perhaps using drag and drop for the different allowed elements (image, text, video). I would take the co-ordinates and generate a master page that can be used later.
Any ideas would be great, I know the question is a bit strange and vague.
Well this is very strange of you to do this as there are already many tools to go about doing this.
Visual Studio (is itself Self Sufficient)
Expression Blend (if you need more control over Design)
Try them.
Still if you are keen about developing something that suits you custom needs then sure go ahead.
As the master page is similar to HTML DOM you can create tags and attributes according to the user's choice.
I suggest you take idea from Visual Studio Designer itself and develop something similar with room for your custom implementations. That way you customer's wouldn't have difficulty in switching to your Application.
As for HTML editing there are Various classes like HTML Element which you can use to create the DOM. Also try out some tools like HTML Agility Pack. Also search for some plug-ins that you can use for making things like HTML Editor. Some has been suggested in Jacob's answer.
It's unclear what you're looking for in an answer. There are several pieces to such a project. Here's what you'd have to create:
A text editor
An ASP.NET parser so that you can do syntax highlighting or WYSIWYG display
An assembly loader so you can detect which items to put in your toolbox
A drag & drop interface
An ASP.NET compiler so that you can test your work in a browser
You may want to look at existing frameworks as a starting point. Eclipse is an engine for building products like yours, so you could base your project in that framework. Scintilla is a popular library for writing text editors with syntax highlighting.

How can I load .ascx user control from console application or windows service?

We use ascx user controls as templates for documents (e.g. invoices).
Now I need to load,render to HTML, then transform to PDF these controls from windows service.
So, what's the correct way/workaround? TemplateControl.LoadControl(path) doesn't work.
To be perfectly honest, I don't know how to do this. However, if I was stuck with this problem, I think I'd download the ASP.NET MVC source, and see what they do to render a partial view (a partial view in MVC is essentially an .ascx control). The Render method on System.Web.Mvc.WebFormView might be a good starting place.
You're probably going about it the wrong way, to be honest. You should probably have your logic embedded in a library, and then have the user control interface with that library. Then, you could use that same logic to populate values on a form, or similar.
You're probably going to run into a lot of trouble trying to get the control to load, and deal with things that don't exist outside of ASP.Net, like session variables, and viewstate.
Generally, what you're asking for is a report, which is handled by something like Crystal Reports, or SQL Server Reporting Services.

Effectivly creating a tabbed website with RadTabStrip

I have an ASP.NET web application that I am making and I am thinking of making it a tabbed interface using Telerik's RadTabStrip. I am trying to figure out the best way to approach this though. I would need about 10 tabs because I have about 10 different main areas of my application. My question is how is the best way to integrate the content into the tabs. All of the simple examples I've seen create RadViews with imbedded HTML/ASP.NET content. The problem with this approach is that, with 10 tabs, it would make my main ASPX file really really big and it would be kind of clumsy to work with, having to integrate all 10 pages into one page. Is there a better or more accepted way to accomplish this?
I think, you have several possibilities:
Use one RadTabStrip and several RadView controls. Put the content for each tab into a separate user control (*.ascx). Then you only have to include the user controls in your main aspx page.
Use a master page and put the RadTabStrip on it. Create a separate page for each area of your application (each using the same master page). Use the RadTab's NavigateUrl property to navigate to the corresponding page (as shown in this demo).
there are certainly other possibilities...

Categories

Resources