Make a wizard on ASP.NET site - c#

I'm absolutely new in ASP.NET.
I've got a web site running under umbraco cms (ASP.NET). I need to create a simple wizard: step by step user will answer questions using simple controls (checkboxes, dropdown lists, radiobuttons, textboxes, etc.). Some steps depends on previous answers, some of them doesn't.
So, I've got 2 questions on this:
What is the best practice to create wizard on ASP.NET web site? I looked at System.Web.UI.WebControls.Wizard class here but I'm not sure it's a good approach to mix asp.net controls and html markup together, especially paying attention to the fact, that every step of the wizard is described in one huge markup file.
I've got the samples of html markup of wizard steps (static aspx pages). That's why I want to divide html and logic. I want to be able to apply new design and markup in the future, not changing code. What is the best approach for this - dividing html and c# code?
Examples are welcome.
Thanks in advance.

Related

language subsite in asp.net

So we have a site that was made quite some time ago. It uses asp 2.0. Currently the site is not multilingual. Since this site was not created with multi langue in mind it contains a lot of images with text on them.
Some time ago a college went ahead to create 3 versions of the site by basically copying the whole site and translating each one. I'm not sure if that's the best way to do it.
I would now like to go ahead and merge those sites. To create something like www.site.com/en/ for English for example.
What would be the best way to achieve this? Can I just take the main site and create for example 2 langue buttons and subfolders containing the translated versions? or is this more complex?
I should note that the site is using a masterpage.
Thanks in advance!
Globalization of an application is huge topic. You could start reading this guide:
https://msdn.microsoft.com/en-us/goglobal/bb688110.aspx
Basically, you have to:
refactor your code to put strings in resource files
refactor your images to use text from resource files and backgrounds (css will help)
Then you have to translate the resource files and put them in the application.
Then you can use the Routes to set the language in the URL using a route like this:
routes.MapPageRoute("PageId", "{language}/MyPage", "~/MyPage.aspx");

How to fix my ASP.NET Webforms structure?

I have a problem with the structure of an old asp.net webform page. Now i want to convert this into an MVC page, because i think there a several things which does MVC automatically...
Here are the facts about the software:
The software is not a "real" asp.net project, just a collaction of many aspx pages which are called with ajax (single pages for every event).
One page for "ModuleOne/save/"
One page for "ModuleOne/edit/"
One page for "ModuleOne/create/" and so on... I think you know what i want to tell you...
The software use two different languages (vb.net, c#) inside the app_code directory with two subdirectories (vbcode, csharpcode)
The software use the "yui compress plugin (js/css)", which is good but there are a lot of better plugins in mvc (do it automatically with bundles...)
The global.asax has a lot of routes to the aspx pages
Now, i want to fix theses problems with the following points:
Convert the collaction of asp.net pages to a "real" asp.net web app project
Convert the vb.net classes to one dll file and add a new reference on it
Eleminate the "yui compress plugin" and replace it with the functionality in mvc (bundles)
Eliminate the "manual routes" in the global.asax an replace this with the "controller handling" in mvc.
In my opinion mvc is the best solution to fix all theses "project-structure-problems"?!
What do you think about this solution/new structure? Make this sense?

Yet another .net custom cms

I'm trying to switch my custom cms written in php into .net c#. I was thinking to use cms as a learning project. I'm going to use C#, NHibernate ORM layer, mssql, mvc3 and jquery.
I'm aware there are plenty of commercials or open source cms, but still I'm going to spend some of my free time trying to learn new technology working on project like this.
So, is there anyone out there who is willing to share some ideas on creating cms domain model, usefull link, ideas, etc.
Thanks
A really basic CMS consist of 3 elements:
one database table to hold your "pages". The table structure is "name" and "content"
a route to transform requests of type /cms/pagename to a fixed controller, the method called cms and pagename as a parameter
a embeddable html editor
Now, there are two ways your "page" can be invoked. It is either create mode or view/edit mode.
In "create" mode, the page is requested but it is not in the database yet (e.g. cms/announcement1). In this mode you create a view consisting of a html editor and upon submit, you persist the page to the database.
In "view" mode, the page is requested and is IS in the database. You perform any necessary rewriting (for example you rewrite internal links of the form [cms/pagename] to a fully routable http address) and render the content.
If the user is authorized to edit the page, you also show a "edit" button which then invokes the html editor with the page loaded and ready to be edited.
And that's it.
There are tons of additional elements (caching, different built-in page types, embedding images, youtubes, preformatted texts) etc. but all of them are optional and you can introduce new features when you have the core already implemented.
Once I wrote a simple CMS following the structure above, it was a part of a bigger solution and till now it's been sucesfully deployed several hundred times. An advantage of a custom CMS is that it can be really simple and easily maintanable.

Use Wordpress Template in c# project

There are plenty of Wordpress template out there, most of them are well designed.
I like to know, is there a way to easy to use Wordpress template in c# project.
Is there any out-of-the-box solution?
Just grab a copy of the output HTML and the CSS of the WP site and apply/build your ASP.NET site around it. This is straightforward in itself. Where most people get confused is when there's a master page in the mix in ASPNET; however, this is not a problem. Just start (with the HTML produced by the WP site) by creating the main divs working from the outside-in, using the master page and then content areas in your pages. Master page(s) will generally contain display elements common to all or a subset of pages.
No, there is nothing "out-of-the-box".
You will need to write your own converter if you wish to do this, though translating a single page shouldn't be too difficult.

Better approach for my first asp.net project?

Background info: 2 semesters of C#(WinForms), plenty of HTML/CSS skill, brand new to asp.net.
I'm building a site for a friend who's a photographer. It's just a gallery site, but he'd like to be able to update the galleries himself and he's not tech savvy in the least. So I'm using the following approach to the problem:
Using ASP.NET 4 WebForms:
I'm using System.IO to get the names of the folders which represent the "Galleries" and populating a TreeView control for navigation.
When a "Gallery" is selected, I have code that builds a (HTML)list of the image files and populates an UpdatePanel with this list.
As this is all based on the folders/files, I'm building him an secure admin page to upload files to new or existing galleries(folders). He'll also be able to edit(move/delete) the existing files from there.
I got it all to work, which was a nice little victory, but I'm realizing this approach is not optimal, as none of the unique galleries are findable via search engine or even URL; the SEO value is nill; the browser back/forward buttons are useless...
Can you guys/gals recommend a better way to go about this?
Is there a way to modify what I've already done to optimize the project?
I'll gladly start over to do this right.
Thanks
Couple of suggestions, if you are doing this for fun - and want to learn something, consider using ASP.Net MVC instead. Both will work, but doing it with MVC will give you more up-to-date and marketable skills.
Second, unless you really want to write the whole thing from scratch, consider using a package to do most of what you want and then customize it.
Something like this would work quite well: http://www.galleryserverpro.com/ and is open source, free/cheap and well supported.
SInce you are new to asp.net, you can learn a lot by picking thru the open source code and seeing how other people with more experience have already solved the very same issues.
When a "Gallery" is selected, I have
code that builds a (HTML)list of the
image files and populates an
UpdatePanel with this list.
Well, most of your problem is sitting inside this sentence. get rid of the UpdatePanel. When you are making ajax request, you are not able to allow browser history. so SEO, back/forward nav. buttons are always issue with updatepanel.
http://ajaxhistory.com/

Categories