How to save dynamicly created template in database? - asp.net-mvc

I would like to enable users to create their own templates in my asp.net mvc web application.
For example, you would create a simple template like a log on control, 2 labels, 2 textboxes, and 1 submit button.
Is it possible to allow users to save such templates in a database and then use them/extend them later? Could you please give me an example or link that shows how someone already did something similar?
I have no idea how to get started.

This may give you some pointers http://mihkeltt.blogspot.com/2009/12/nvelocity-template-engine-sample.html

Related

How to add an mvc page to umbraco

I have Umbraco 7.5 and I need to know how to create normal MVC pages for adding new data to my site.
Lets say I have a Doctype "Node" in back-office. I want to let some people be able to add/edit some nodes without going through back-office. How can I do it?
I've tried to create add my view and controller (the MVC way), but apparently Umbraco hijacks all routing and my controller won't hit at all.
I've googled the matter (which is hard since I am not looking for Umbraco forms :| )and I've found this. But I prefer not to add my form as a part of other page. I mean, does it make sense to create a page in back office from type "something" and then on its template I do my add/edit form of another type? Seems strange, right?
I appreciate any ideas/ solution to this matter
You have a couple of options here. You can create a physical page for the editor to sit on, and add the editor as a SurfaceController action (basically an MVC Partial with Postback, that is still part of the Umbraco pipeline). Your form can then use the Content Service API to update the details. The advantage of this method is your code will have access to all of the Umbraco methods and templating out of the box. You could also use WebAPI controllers for the form if you want to do it all client side with JS requests.
You could also use route hijacking: https://our.umbraco.org/documentation/reference/routing/custom-controllers this allows you to have your own custom controllers for Umbraco routes, rather than using the default Umbraco ones. This is a bit more work to set up.
Finally, you can also tell Umbraco to ignore certain paths entirely, and you could run your controllers on those paths. The disadvantage here is that as the routes are being ignored by Umbraco, you don't automatically have access to all the useful Umbraco templating etc.
I've used the first method recently, and it works fine. The only caveat is that allowing users to edit nodes will fill up the version table quite quickly if a lot of users are editing a lot of nodes (every time a node is saved, a version is created). If you're going down this route, you may want to investigate something like Unversion: https://our.umbraco.org/projects/website-utilities/unversion/ which helps to keep old versions more manageable in situations like this.

Umbraco Option to define dropdown list via Umbraco

I am facing an issue using Umbraco 7.0. My requirement is that I need to create a contact us form page and from that page an email will be sent to admin. I thought of creating .Net User Control for achieving
this functionality.
However, in Contact Us page, there is a field like "Functional Area" that client wants a drop down and in that he wants, Option to define drop down list via Umbraco.
Could anyone please guide me how to achieve the same.
Rather than using the old User Control method, you would be better off writing one using Razor which can use a Model populated with content. There is a nice example here of something very similar that you can extend
http://www.diplo.co.uk/blog/2012/5/24/creating-an-umbraco-form-using-pure-razor.aspx

ASP MVC 5 (Microsoft.AspNet.Identity) User Management Package

Does asp.net mvc5 really not come with some sort of default controllers and views to manage your users? things like creating a new role, and then assigning it to a user etc etc?
Is every single mvc5 website supposed to code their own?
Over and over again?
I get that we can now add custom fields etc to our users, but surely some sort of simple base built in manager isn't asking for too much?
Is there some magical nuget package or something I'm missing?
There doesn't seem to be anything like this.
I have added an item onto the asp.net uservoice list and you can vote for it there.
I'm marking this as closed.
http://aspnet.uservoice.com/forums/41201-asp-net-mvc/suggestions/5009231-add-a-default-asp-mvc-5-microsoft-aspnet-identity

Allow user to make email template with dynamic MVC variables

I'm very new to MVC 3. My client needs an admin page where she can edit basic email templates like "Dear %FirstName%, Your order has been placed" which I will create. When an order comes in, it will automatically then send an email to the person, using her template.
What I'd like to be able to do, is automatically match up the fields in the template (like %FirstName%) with the model fields of the order, i.e. Model.Order.FirstName when sending the mail. I could obviously use a helper class to manually go and regex things, but I'm looking for a Razor-esque method for this.
I've looked (briefly) at MvcMailer and RazorEngine for this, but can't quite work it out, as those tools seem to rely on a .cshtml file.
Does anyone know how to achieve what I'm trying to do? Any suggestions are appreciated!
You should consider looking at Fluent Email, which now supports razor syntax.
http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/

creating new usercontrols at runtime in ASP.NET MVC

My situation is that the user is creating an entity on my site which contains the particlars of the driectors of that company, name address etc..
The Director form is a separate user control with the appropriate textboxes etc.
At run time we don't know how many of these directors there will be so I need one to be able to use something like an "ADD DIRECTOR" or "DELETE DIRECTOR" button which will present or delete the another usercontrol to add the additional director.
Currently I am trying to make this happen within a pane of the JQuery Accordion control.
I have looked many places for how to do this but to no avail.
Can anyone tell me where I might find some inforamation about how I can do this?
All the best
Paul
This is not exactly "adding usercontrols". But I suggest you look at a template engine like this one: http://aefxx.com/jquery-plugins/jqote/

Resources