European ASP.NET MVC Hosting

BLOG about Latest ASP.NET MVC Hosting and Its Technology - Dedicated to European Windows Hosting Customer

ASP.NET MVC 6 Hosting Russia - HostForLIFE.eu :: How to Highlight Selected Menu Item in ASP.NET MVC ?

clock February 13, 2015 07:23 by author Peter

Each time we are making application with some quite menu it's nice to own the essential practicality to focus on selected menu item in ASP.NET MVC 6 . There are some solutions you'll notice within the web, but when I've tried to use one it hasn't been operating excellent. So, let's produce our own in 3 steps.

1. First of all we want to make MVC HTML helper class, containing method to use the appropriate CSS class based on some conditions.
2. Now, we want the CSS class itself to be applied for selected  menu item, it is very easy, background color change, font modification, etc.
3. The menu HTML ought to be changed to use our helper while rendering page.

And here is the example helper class code:
public static class MenuHelper
{
    public static string IsSelected(this HtmlHelper html, string controller = null, string action = null)
    {
        const string cssClass = "selected";
        string currentAction = (string)html.ViewContext.RouteData.Values["action"];
        string currentController = (string)html.ViewContext.RouteData.Values["controller"];
        if (String.IsNullOrEmpty(controller))
            controller = currentController;
        if (String.IsNullOrEmpty(action))
            action = currentAction;
        return controller.Split(';').Contains(currentController) && action.Split(';').Contains(currentAction) ?
            cssClass : String.Empty;
   }
}

Pretty easy, isn't it? we are setting the 'selected" CSS class based on the controller and action combination (both arguments are optional). sometimes we've in the menu only main pages, however we would like to tell user in a way regarding the context whereas he's opening sub-page. the best way is to stay the menu item highlighted when user is browsing some sub-pages. This helper implementation is supporting this case likewise. we are able to pass as arguments many controller names, or action names and for those groups we are able to highlight particular menu item.

Highlight menu item for Index action from Home controller:
class="@Html.IsSelected(null, "Index")"

Highlight menu item for several actions coming from one controller:
class="@Html.IsSelected(null, "Contact;About")"

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting UK - HostForLIFE.eu :: How to create a DropDownList field for ASP.NET MVC Razor view ?

clock February 12, 2015 07:13 by author Peter

Today, this tutorial will show you how to create a DropDownList field for ASP.NET MVC 6 Razor view. First, you must create a new project and here is the code that I use:

Controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcNew.Models;
namespace MvcNew.Controllers
{
    public class HomeController : Controller
    {
            public ActionResult DropDown()
        {
            List<SelectListItem> items = new List<SelectListItem>();
            items.Add(new SelectListItem { Text = "Developer", Value = "0" });
            items.Add(new SelectListItem { Text = "Analyst", Value = "1" });
            items.Add(new SelectListItem { Text = "Admin", Value = "2", Selected = true });
            items.Add(new SelectListItem { Text = "Manager", Value = "3" });
            ViewBag.Desig_Type = items;
            return View();     
        }
    }
}

View
@model MvcNew.Models.Home
@{
    ViewBag.Title = "Drop";
}
<h2>Drop</h2>
   @using (Html.BeginForm("Category", "Home", FormMethod.Get)) {
    <fieldset>
            Designation
            @Html.DropDownList("Desig_Type")
        <p>
            <input type="submit" value="Submit" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
And here is the output from the above code:

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting Europe - HostForLIFE.eu :: How to Create a Gridview Header Check Box in ASP.NET MVC ?

clock February 6, 2015 06:53 by author Peter

In this article we will tell you How to Create Header Checkbox in web Gridview with ASP.NET MVC 6. You need to Simply Change in this Example is that in Index.cshtml document.

I used the following code to show the Header Checkbox:
columns: grid.Columns(
        grid.Column(header: "{CheckBoxHeading}",  format:
            @<text><input class="box"  type="checkbox" /></text>),
            grid.Column("ID", canSort: true, style: "Id"),
        grid.Column("Name", canSort: true, style: "Name"),
        grid.Column("Question", canSort: true, style: "Question"),
         grid.Column("", header: "Actions", format: @<text>
                 @Html.ActionLink("Edit",   "Edit",   new { id=item.Id} )
                  @Html.ActionLink("Delete", "Delete", new { id=item.Id} )
                </text>
      )
).ToString().Replace("{CheckBoxHeading}", "<input type='checkbox' id='allBox'/>")  


In which we additionally give Facility to user to choose multiple record at once focused around checkbox selection. When client click on Header checkbox then it will automatically check all the checkbox means select All row or record.

if the GridView contain large number of Record at that point user wish to delete all record then user have needed more time to pick each {and every|and every} record by click on each row checkbox, thus for that reason we offer a facility to user simply click on one Header CheckBox and choose the all row or Record in Gridview.

If you have previous Example, then simply copy this code and paste it in Index.CSHtml file:
Index.CSHtml File
@model IEnumerable<finalpaging.Models.poll>
@{
    ViewBag.Title = "Index";
}
<!DOCTYPE html>
<html>
<head>
    <title>WebgridSample</title>
    <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
     //Select or Deselect all checkboxs in the grid       
$(document).ready(function () {
            $("#allBox").click(function () {
                $(".box").attr("checked", $(this).attr("checked") ? true : false);
            });
                           });
</script>
    <style type="text/css">
        .webGrid { margin: 4px; border-collapse: collapse; width: 500px;  background-color:#FCFCFC;}        .header { background-color: #C1D4E6; font-weight: bold; color: #FFF; }
        .webGrid th, .webGrid td { border: 1px solid #C0C0C0; padding: 5px; }
        .alt { background-color: #E4E9F5; color: #000; }
        .gridHead a:hover {text-decoration:underline;}
        .description { width:auto}
        .select{background-color: #389DF5}
    </style>
</head>
<body>
    <p>
    @Html.ActionLink("Create New", "Create")
</p>
    @{
    finalpaging.Models.poll product = new finalpaging.Models.poll();
}
    @{
    var grid = new WebGrid(Model, canPage: true, rowsPerPage: 10, selectionFieldName: "selectedRow",ajaxUpdateContainerId: "gridContent");
        grid.Pager(WebGridPagerModes.NextPrevious);}
        <div id="gridContent">                  
MvcHtmlString.Create(grid.GetHtml(tableStyle: "webGrid",
                headerStyle: "header",
                alternatingRowStyle: "alt",
                selectedRowStyle: "select",
    fillEmptyRows: false,    
    footerStyle: "footer",
    mode: WebGridPagerModes.All,
    firstText: "<< First",
    previousText: "< Prev",
    nextText: "Next >",
    lastText: "Last >>",
    columns: grid.Columns(
        grid.Column(header: "{CheckBoxHeading}",  format:
            @<text><input class="box"  type="checkbox" /></text>),
            grid.Column("ID", canSort: true, style: "Id"),
        grid.Column("Name", canSort: true, style: "Name"),
        grid.Column("Question", canSort: true, style: "Question"),
         grid.Column("", header: "Actions", format: @<text>
                 @Html.ActionLink("Edit",   "Edit",   new { id=item.Id} )
                  @Html.ActionLink("Delete", "Delete", new { id=item.Id} )
                </text>
      )
)).ToString().Replace("{CheckBoxHeading}", "<input type='checkbox' id='allBox'/>")                            
),
 </div>   
</body>
</html>

I hope this tutorial works for you!

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting Belgium - HostForLIFE.eu :: How to Handling multiple submit buttons on the same form in MVC ?

clock February 5, 2015 07:08 by author Peter

Sometimes you got situation like more than one submit buttons on a similar form in ASP.NET MVC 6. At that point, How we will handle the click event of every and each buttons on your form?

In this post I will explain you about Handling multiple submit buttons on the same form in MVC.To fix this problem, I'm progressing to justify the varied techniques for handling multiple buttons on the same form in MVC. Suppose you've got a user Login form like as below:

On the above picture, we have the SignUp, SignIn and the Cancel buttons. Suppose on Signup button click you have to open Signup window & on SignIn button click you have to open Login window and on Cancel button click you are returning to home page. For handling all of the above buttons, we have the following methods:
Export Gridview to Excel: Gridview to Excel
Insert,Update,Delete in ModalPopup CRUD operation in ModalPopup
Read and Write in Text File in ASP.NET Read and Write File in ASP.NET

Now, Make the view Form with Multiple Button in Home Folder with the following code.

MultipleCommand.cshtml
@model  Mvc4_Multiple_Submit_Button.Models.RegistrationModel
@{
    ViewBag.Title = "Handling Multiple Command Buttons";
}
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<h2>User's Signup Form</h2>
@using (Html.BeginForm("MultipleCommand", "Home", FormMethod.Post, new { id = "submitForm" }))
{
    <fieldset>
        <legend>Registration Form</legend>
        <ol>
            <li>
                @Html.LabelFor(m => m.Name)
                @Html.TextBoxFor(m => m.Name, new { maxlength = 50 })
                @Html.ValidationMessageFor(m => m.Name)
            </li>
            <li>
                @Html.LabelFor(m => m.Address)
                @Html.TextAreaFor(m => m.Address, new { maxlength = 200 })
                @Html.ValidationMessageFor(m => m.Address)
            </li>
            <li>
                @Html.LabelFor(m => m.MobileNo)
                @Html.TextBoxFor(m => m.MobileNo, new { maxlength = 10 })
                @Html.ValidationMessageFor(m => m.MobileNo)
            </li>
        </ol>
        <button type="submit" id="btnSave" name="Command" value="Save">
            Save</button>
        <button type="submit" id="btnSubmit" name="Command" value="Submit">
            Submit</button>
        <button  type="submit" id="btnCancel" name="Command"  value="Cancel" onclick="$('#submitForm').submit()">
            Cancel (Server Side)</button>
        <button  type="submit" id="btnCancelSecForm" name="Command"  value="Cancel" onclick="$('#cancelForm').submit()">
            Cancel (Server Side by Second Form)</button>
        <button name="ClientCancel" type="button" onclick=" document.location.href = $('#cancelUrl').attr('href');">
            Cancel (Client Side)</button>
        <a id="cancelUrl" href="@Html.AttributeEncode(Url.Action("Index", "Home"))" style="display:none;">
        </a>
    </fieldset>
}
@using (Html.BeginForm("MultipleButtonCancel", "Home", FormMethod.Post, new { id = "cancelForm" })) { }

Next step, in Homecontroller include the MultipleCommand Method to handle the multiple button with the following code.
HomeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc4_Multiple_Submit_Button.Models;
namespace Mvc4_Multiple_Submit_Button.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
              public ActionResult MultipleCommand()
        {
            return View();
        }
        [HttpPost]
        public ActionResult MultipleCommand(RegistrationModel mReg, string Command)
        {
            if (Command == "Save")
            {
                //TO DO : for Save button Click
            }
            else if (Command == "Submit")
            {
                //TO DO : for Submit button Click
            }
            else
            {
                //TO DO : for Cancel button Click
                return RedirectToAction("Index");
            }
            return View();
        }
        [HttpPost]
        public ActionResult MultipleButtonCancel()
        {
            //TO DO : for Cancel button Click
            return RedirectToAction("Index");
        }
    }
}

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting Netherlands - How to Clean up Controller Class in ASP.NET MVC?

clock January 30, 2015 06:12 by author Peter

In this article, I will tell you about How to Clean up Controller Class in ASP.NET MVC 6.  Here may be a tiny piece and the way i use some easy tricks to assist clean up my Controllers in ASP.NET MVC.

public class MyController : Controller
{
    public MyEntities Db { get; set; }
    protected override void OnActionExecuting(
        ActionExecutingContext filterContext)
    {
        if (filterContext.IsChildAction)
            return;
        this.Db = new MyEntities();
        base.OnActionExecuting(filterContext);
    }
    [HttpPost]
    public ActionResult Index(FormCollection form)
    {
        string srch = form["Search"] ?? string.Empty;
        return RedirectToAction("Index",
            new { search = srch });
    }
    protected void AttachToDb(EntityObject obj,
        bool save = false, string entityKeyField = "Id")
    {
            obj.EntityKey = new EntityKey(
                obj.ToPluralizedString(), entityKeyField,
                obj.GetType().GetProperty("Id")
                .GetValue(obj, null));
            Db.Attach(obj);
            Db.ObjectStateManager.ChangeObjectState(
                obj, System.Data.EntityState.Modified);
            if (save) Db.SaveChanges();
    }
}


The first issue within the code is easy declaration of an EntityContext - this can be enforced directly, however might (and sometimes should) be implemented differently for dependency injection, however you get the thought. Here is wherever I conjointly prefer to include stuff that's typically used and will be very important (and centralized) for an application like an output sort for web services (JSON, XML, etc.).

Next the OnActionExecuting is over-ridden and also the Context is initialized. Here is wherever you'll be able to initialize the properties you set above.

The next methodology, the HttpPost Index method is simply an example of however often times you'll be able to consolidate a normally used method. For this instance, it absolutely was from an application that had searches on all index pages. Rather than repeating this code in each controller, you'll be able to simply place it here.

The final methodology has become terribly helpful. A use I often realize, is when taking in a large model when an ASP.NET MVC POST event, I will attach the model to the db generically with none further work

This method may be a bit confusing, however it's merely attaching the new model to the db while not a db lookup. In my tables, I typically have a field 'Id' that houses the primary Key of every table, whether or not it's an Int or Guid. This way, I will merely pass in whatever object i'm currently working with, and by using the pluralize method, and reflection, the method will find out that table to connect the model to - eliminating the requirement on behalf of me to try and do extra writing. or else, if i need to change the Key from 'Id', I will pass that in as well.

Now once I get a model being posted, it's simple to deal with:
[HttpPost]
public ActionResult Edit(Widget model)
{
    if(ModelState.IsValid)
    {
        AttachToDb(model, true);
        //do stuff
    }
    else { /*do other stuff*/ }
}


This avoids the need to take another trip to the db, change the properties on the object, then submit - streamlining the method very much and lowering plenty of code. This would be an example of however this is able to be done manually with the normal Controller class:

[HttpPost]
public ActionResult Edit(Widget model)
{
    if(ModelState.IsValid)
    {
        MyEntities db = new MyEntities();
        Widget w = db.Widgets.Single(x => x.Id == model.Id);
        w.Name = model.Name;
        w.Serial = model.Serial;
        db.SaveChanges();
        //do stuff
    }
    else { /*do other stuff*/ }
}

Not a large difference once you are simply getting a pair of values, however you may see how a model with twenty or thirty fields are often block from 30+ lines to just 1 or 2.

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting UK - HostForLIFE.eu :: How to Get the Values from HTTP Query String Variables in View in ASP.NET MVC 6 ?

clock January 29, 2015 07:21 by author Peter

This method can be utilized as a part of any perspective however it is prescribed to verify your ViewModel contains all essential data. We are going to utilize this methodology as a part of design page, as regularly layout page does not have any model(it can have however then it may get exceptionally muddled and by and by I think for enormous tasks it could be extra constraint).

Consider a circumstance in which you are occupied with values for variables from HTTP request.
http://localhost:49853/Home/Index?searchType=global

In above address we are passing variable searchType. How about we accept that searchType. can have 2 separate values - local and global.
Main CSS file:
#mainNav.global {
  background: #404939; }
  #mainNav.global nav.nav {
    background: none; }
    #mainNav.global nav.nav .top {
      background: #404939; }
    #mainNav.global nav.nav a:hover, #mainNav nav.nav a.active {
      background-color: #7dc243; }     
      #mainNav.local
      {
          background: #3C7987; }
        #mainNav.localnav.nav {
                  background: none; }
        #mainNav.local nav.nav .top {
                          background: #3C7987; }
        #mainNav.local nav.nav a:hover, #mainNav nav.nav a.active {
                        background-color: #7FDCFF; }


In layout page in _Layout file header section:
<header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
            </div>
            <div class="float-right">
                <section id="login">
                    @Html.Partial("_LoginPartial")
                </section>
                @{
                    string searchClass = "global";
                    if (HttpContext.Current.Request.Params["searchType"] == "local")
                    {
                        searchClass = "local";
                    }
                }
                <div id="mainNav" class=@searchClass>
                    <nav class="nav" data-nav>
                        <ul>
                  @using (Html.BeginForm("Index", "Home", FormMethod.Post, new { id = "searchForm" }))
                            {
                                @Html.ActionLink("Global","Index","Home", new { searchType= "global" }, null)
                                @Html.ActionLink("Local","Index", "Home", new { searchType = "local" }, null)
                                <input type="search" name="searchMode" value="" placeholder="Search...">
                                <input type="submit" name="submitBtn" value="Search">
                            }
                        </ul>
                    </nav>
                </div>
               <nav>
                    <ul id="menu">
                        <li>@Html.ActionLink("Home", "Index", "Home")</li>
                        <li>@Html.ActionLink("About", "About", "Home")</li>
                        <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                    </ul>
               </nav>
            </div>
        </div>
    </header>

Now, we aregoing to toggle class name for navigation bar. If we are in global searchType background color is #7dc243, in local searchType 7FDCFF.

If you are in global searchType your address is :
http://localhost:49853/?searchType=global

In local :
http://localhost:49853/?searchType=local

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting UK - HostForLIFE.eu :: Changing image opacity & Zoom on mouseover using jQuery in ASP.NET MVC

clock January 23, 2015 12:20 by author Peter

With this post, I will explain you about changing image opacity & zoom on mouseover with jQuery in ASP.NET MVC. First step, write the following code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to change image opacity and Zoom on mouseover using jQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#imgSample").css("opacity", "0.5");
            $("#img1").hover(function () {
                $(this).css("opacity", "1.0");
                $(this).animate({ width: "400px" }, 'slow');
                $(this).animate({ height: "300px" }, 'slow');
            },
              function () {
                   $(this).css("opacity", "0.5");
                   $(this).animate({ width: "200px" }, 'slow');
                   $(this).animate({ height: "150px" }, 'slow');
               });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <img id="imgSample" src="images/NiceImage.jpg" width="200px" height="150px" alt="img" />
        <img id="img1" src="images/NiceImage.jpg" width="200px" height="150px" alt="img" />
    </div>
    </form>
</body>
</html>

And here is the result of the code above.

The Opacity 0.5 shows like the picture below.

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



ASP.NET MVC 6 Hosting Russia :: Creating Dynamic DropdownList in ASP.NET MVC 6

clock January 22, 2015 05:54 by author Peter

With this short tutorial, I will tell you how to create dynamic DropDownList with ASP.NET MVC 6. First thing you should do is make 2 DB Tables. And here is the example:

1.Designstions
Columns: DesignationID(PK,FK,numeric(6,0),not null)
             Designation (Varchar(50),null)

2.Persons
Columns: PersonID(PK,numeric(6,0),not null)
                 DesignationID(FK,numeric(6,0),not null)


Create The Models:
Designation.cs
{
   public decimal DesignationID { get; set; }
    public string Designation { get; set; }
}


Person.cs
{
    public decimal PersonID{ get; set; }
     [DisplayName("Designation")]
   public decimal DesignationID{ get; set; }
    public virtual  Designation designation { get; set; }
}


PersonController.cs
{
  public class PersonController: Controller
{
     public ActionResult Index()
        {
            var  mamun= db.Persons.Include(t => t.designation );
            return View(mamun.ToList());
        }
 public ActionResult Create()
        {
          ViewBag.DesignstionID= new SelectList(db.Designstions, "DesignstionID", "Designstion");
            return View();
        }
  public ActionResult Edit(decimal id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Person person = db.Persons.Find(id);
            if (tblsalesperson == null)
            {
                return HttpNotFound();
            }
         ViewBag.DesignstionID= new SelectList(db.Designstions, "DesignstionID", "Designstion",person.DesignstionID);
                   return View(person);
        }
}
}

Next step, create.cshtml & Edit.cshtml:
<div class="form-group">
                @Html.Label("Designation", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownList("DesignstionID")
                    @Html.ValidationMessageFor(model => model.DesignstionID)
                </div>
            </div>

I am using this following code to Add CSS class  'dropdownList' :
@Html.DropDownList("DesignstionID", (IEnumerable<SelectListItem>)ViewBag.DesignstionID, new { @class = "dropdownList" })  Instead Of that.

Index:  
@foreach (var item in Model)
{
    <td>
                    @Html.DisplayFor(modelItem => item.Designation.Designation)     
  </td>
}

HostForLIFE.eu ASP.NET MVC 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Month List

Tag cloud

Sign in