Click here to Skip to main content
15,896,269 members
Articles / Web Development / ASP.NET

Improving ASP.NET MVC MUSIC STORE more usability with DotNetAge in 30 minutes

Rate me:
Please Sign up or sign in to vote.
4.87/5 (12 votes)
23 Nov 2010GPL38 min read 83.3K   5.5K   32  
Using the DotNetAge to upgrade the ASP.NET Mvc Music Store add widgets and security features just in minutes.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Forum>" %>
<% var isGroup =Model!=null ? Model.IsGroup : (bool)ViewData["IsGroup"]; %>
<input name="IsGroup" value="<%:isGroup %>" type="hidden" />
<input id="__forum_id" value="<%: Model!=null ? Model.ID : 0 %>" type="hidden" />
<table style="width: 100%;" cellpadding="5">
    <tr>
        <td style="width: 250px;" class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                <%=Html.Global("RES_TITLE")%></h4>
            <div style="padding-left: 5px;">
                The title of the forum.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.TextBox("Forum.Title", Model!=null?Model.Title:"", new TextBoxOptions() { Width = 200 })%>
            <%:Html.ValidationMessageFor(m=>m.Title) %>
        </td>
    </tr>
    <tr>
        <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                <%=Html.Global("RES_DESC")%>:</h4>
            <div style="padding-left: 5px;">
                The description of the forum.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.TextArea("Forum.Description",Model!=null?Model.Description:"")%>
        </td>
    </tr>
    <% if (!isGroup)
       { %>
    <tr>
        <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                <%=Html.Global("forums", "Lock")%></h4>
            <div style="padding-left: 5px;">
                If the forum is locked, only moderators and administrators can post or reply in this forum.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.CheckBox("Forum.IsLock", "Lock the forum", Model != null ? Model.IsLock : false)%>
        </td>
    </tr>
    <tr>
        <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                <%=Html.Global("forums", "Moderated")%></h4>
            <div style="padding-left: 5px;">
                If the forum is moderated, posts have to be approved by a moderator.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.CheckBox("Forum.IsModerated", "IsModerated", Model != null ? Model.IsModerated : false)%>
        </td>
    </tr>    <tr>
        <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                Allow anonymous</h4>
            <div style="padding-left: 5px;">
               Allows anonymous view all threads and posts.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.CheckBox("Forum.AllowAnonymous", "AllowAnonymous", Model != null ? Model.AllowAnonymous : false)%>
        </td>
    </tr>
    <tr>
        <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                Allow attachment</h4>
            <div style="padding-left: 5px;">
                Allows users can upload the attachment files of the post.
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
            <%=Ajax.CheckBox("Forum.AllowAttachment", "AllowAttachment", Model != null ? Model.AllowAttachment : true)%>
        </td>
    </tr>
    <tr>
    <td class="ui-widget-content ui-border-bottom">
            <h4 style="margin-top: 5px; margin-bottom: 5px;">
                Moderators</h4>
            <div style="padding-left: 5px;">
                The moderators of this forum
            </div>
        </td>
        <td class="ui-widget-content ui-border-bottom">
        <% var _mods = "";
           if (Model != null)
           {
               if (!Model.Moderators.IsLoaded) Model.Moderators.Load();
               if (Model.Moderators.Count > 0)
                   _mods = string.Join(",", Model.Moderators.Select(m => m.Moderator).ToArray());
           }
            %>
            <%:Ajax.TextArea("Forum.Moderators",_mods)%>
        </td>
    </tr>
    <%} %>
</table>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Architect DotNetAge
China China
In 1999, I started programming using Delphi, VB, VJ.From 2002 I started with .NET using C#.Since 2005 when i had became an EIP product manager I was focus on EIP and CMS technique. In 2008 i established dotnetage.com and started to shared my ideas and projects online. I believe "No shared no grow"

www.dotnetage.com

Comments and Discussions