hgs yükleme
My Cart (0)  |  My Orders  |  My Downloads  |  My Auction  |  My Account  |  Help

Login |Register        Search

DNN and Razor 6 - No Forms

                Print      Add To Favorite     Add To Watch List     Contact Author

Creator: host   5/24/2012 2:35:07 AM    Author: Charles Nurse   Source: http://www.charlesnurse.com/post/Razor-Tips-and-Tricks-3-Look-No-forms.aspx   Views: 2680    0    0  
Module develop Razor WebMatrix

On Monday, we launched the Razor DotNetNuke Hackathon with a meeting of SEADUG (Seattle DotNetNuke User Group) held at Microsoft offices in beautiful downtown Bellevue.

For those of you proposing to write Razor “scripts” as part of the Hackathon, I have decided to write a series of short Tips and Tricks.

In this third post I will cover a couple of caveats when using Razor scripts in the DotNetNuke context.

No Forms

The first caveat is that because the Razor script is still running within the context of a ASP.NET WebForm, you need to be careful when using Razor scripts that you find (or write yourself) for collecting form data.  <form> tags cannot be embedded inside other form tags – and because an ASP.NET WebForm (.aspx) always contain a <form> tag, this means that Razor scripts used in the DotNetNuke context cannot contain <form> tags.

The workaround is simple – just remove the <form> tags from any Razor script you use in DotNetNuke.  Any submit button will post back as usual and DotNetNuke will pass the Form variables to the script as normal.


The second caveat is that you should be careful with following Razor script examples that use Urls.  For example you will often see something like:


The initial “/” means that we the url is starting at the web-root.  As most Razor examples you see will assume that your Razor script is executing in the context of web-root – this example is fine.  But in DotNetNuke, the Shared directory would probably be buried deep in the website folder structure (for example ~/DesktopModules/RazorModules/MyModule/Shared/). 

In this case just leave out the initial “/” so that the url is relative.


Rating People: 18   Average Rating:     

     DnnModule.com is built to provide DNN quality modules and DNN skins, some of them are free, some not. We wish these stuffs (free or not ) can be useful to you.

     Besides that, we also provide a full range of professional services, ranging from web site build, seo, system management, administration, support, senior consultancy and security services. We act as if your development project or network was ours, with care and respect. We are not satisfied until it works the way you want it to, and we don't silently ignore found issues as somebody else's problem.