Click here to Skip to main content
15,884,986 members
Articles / Web Development / CSS

A Simple ASP.NET MVC Grid with Multilingual Support+Drop Down Menu

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
2 Nov 2013CPOL 11.2K   4  
Using grid and search grid using Ajax or without Ajax, and using Resource Files to enable multi language support
@using MvcApplication1.Models
@using MvcCommon.Resources
@{
    ViewBag.Title = "فهرست مشتریان";
}

@model PagingModel

<h2>@ViewBag.Title</h2>
<div class="buttons">
    <a href="/Customer/Create" class="button action blue "><span class="icon icon3"></span><span class="label">ایجـاد</span></a>
    <div class="dropdown">
        <a href="#" class="button"><span class="icon icon3"></span><span>@Resource.Lbl_Create</span><span class="toggle"></span></a>
        <div class="dropdown-slider">
            <a href="#" class="ddm"><span class="label">شخص حقیقی</span></a>
            <a href="#" class="ddm"><span></span><span class="label">حقوقی</span></a>
            <a href="#" class="ddm"><span class="label">پرسنل</span></a>
            <div>
                در این بخش هر چه می خواهید بنویسید و برای خودتان بسازید
                    <input type="text" value="مقدار پیشفرض" />
            </div>
        </div>
    </div>
    <div class="dropdown">
        <a href="#" class="button"><span>ایجاد</span><span class="toggle"></span></a>
        <div class="dropdown-slider" style="width: 180px">
            <a href="#" class="ddm"><span class="icon icon3"></span><span class="label">شخص حقیقی</span></a>
            <a href="#" class="sep">
            </a>
            <a href="#" class="ddm"><span></span><span class="label">اشخاص حقوقی- شرکتها و سازمانها</span></a>
            <a href="#" class="ddm"><span class="label">پرسنل</span></a>
        </div>
    </div>
</div>

@using (Html.BeginForm("Index", "Customer", FormMethod.Post, new { id = "searchForm" }))
{
    @Html.EditorFor(c => c.SearchTerm)
    <button class="action" style="float: none" onclick="search();return false;"><span class="activeIcon icon198"></span><span class="label blue">جستجو</span></button>
    <div id="divResult">
        @Html.Partial("Grid", Model.ResultList)
    </div>
}
@section Scripts {
    @Scripts.Render("~/bundles/jqueryui")
    <script type="text/javascript">
        function createCs() {
            $('div#container').load('customer/create');
        }
        function search() {
            //post normally
            //uses input name as parameter in action
            document.forms["searchForm"].submit();

            //post with ajax
            //var t = $('input#SearchTerm').val();
            //$('#divResult').load('/customer/Grid?term=' + t);
        }
        $(function () {
            $("input#SearchTerm").autocomplete({
                source: '@Url.Action("GetCustomersJson", "Customer")'
            });

            $("table tr:even").addClass("evenTr");
            $("table tr:odd").addClass("oddTr");
        });
    </script>
}
@section siteCss{
    @Styles.Render("~/Content/themes/base/css")
}

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 Code Project Open License (CPOL)


Written By
Software Developer (Senior) DPI
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions