If you trying to update the partial view with Ajax.ActionLink and instead of reloading the partial view within the view, it loads on entire web page or overwrites the view with the partial view’s content. Than you need to check the following things in your View and Partial View. Continue reading “How to solve: Ajax.ActionLink shows partial view on entire page”
Tag: MVC4
Filtering WebGrid using Ajax.ActionLink(s) in MVC
In the previous article on the Filtering web grid, we used the DropDown for the filtering. I this article I’ll use the links to filtering the webgrid. In most shopping sites you can see the sidebar with links, user can use those link to filtering the product search area. Continue reading “Filtering WebGrid using Ajax.ActionLink(s) in MVC”
MVC 4 Exercise-1: Bind dropdownlist based on what is selected in another dropdownlist
Introduction: Create a MVC 4 page that will contains two dropdownlist controls. The first dropdownlist will be for State list and second will contains the City list on the basis of the selected state. Continue reading “MVC 4 Exercise-1: Bind dropdownlist based on what is selected in another dropdownlist”
Radio Buttons in WebGrid MVC
In the previous article we have discussed about how to embed jQuery UI Spinner control, TextArea and TextBox control in the MVC WebGrid. And Now in the following example we’ll see that how to show the radio buttons in the WebGrid. Continue reading “Radio Buttons in WebGrid MVC”
Custom formatting of the columns in WebGrid MVC
The previous example will render all columns but you may want to limit which columns are displayed and how the style will be implement. First I’ll show you the rendering the numbers of selected columns, you can achieve this by passing the array of the columns in the WebGrid constructor. Continue reading “Custom formatting of the columns in WebGrid MVC”
Getting started with WebGrid in MVC : Render the basic WebGrid
In this example I’ll show you that how to render the basic WebGrid in the Razor View. I’ll use the Sample Employee SQL Database in the examples. I believe you have setup the all prerequisites for Walk-through of WebGrid in MVC 4.
Continue reading “Getting started with WebGrid in MVC : Render the basic WebGrid”
Create Radio button List from the Model in MVC
Let’s suppose that we have a Model for the tbl_department and we want to render a radio button list for all departments. Take the following model as an example.
In the following article you will see that how to create a Radio button list in MVC. The article use the EmployeeDb sample SQL database( Download: scripts to create the EmlpoyeeDb SQL database) and MVC 4 framework with Razor engine view. Continue reading “Create Radio button List from the Model in MVC”
Convert MVC WebGrid data into JSON string and use it in controller
In this article I will demonstrates how to generate the JSON string from the WebGrid data in your MVC web application. In addition, you will learn how easy it is to use this JSON data in your controller. I assume that you have some basic knowledge of the MVC framework so I am not describing that how to start the MVC project from the scratch. Continue reading “Convert MVC WebGrid data into JSON string and use it in controller”
How to show Indian currency symbol in MVC WebGrid
₹ is the new Indian Rupee currency sign.it was presented to the public by the Government of India on 15 July 2010. When you try to show ₹ currnecy symbol using Culture and UCulture, you get the default currency symbol ‘Rs’ not ₹ then you need to set customize the symbol. Same problem occurs when you want to show this symbol in WebGrid in MVC projects. Continue reading “How to show Indian currency symbol in MVC WebGrid”
Bind DropdownList box from the Enum values in MVC4
Yesterday i need to bind a DropDownList control with the Enum type. I have been using the html.DropDownList(name as string, IEnumerable <SelectListItem > )
method to bind show the list of the items but this method need the IEnumerable <SelectListItem > and i have a Enum type. Suppose you have a Enumeration in your model like this:
Public Enum DepartmentList Sales HR Marketing Production End Enum
You can not use this statement, it will gives an error: ‘DepartmentList is the type in model you can use as expression‘
<%-- This is the Wrong way --> <%: Html.DropDownList("test", Model.DepartmentList)%>
So i discover a way to change the Enum type in the array and then cast in to SelectList. And you can do that in a single statement like as:
<div> Select Department: @Html.DropDownList("lstdepartment", new SelectList(Enum.GetValues (typeof(MvcApplication1.Models.Employee.Deaprtmentlist)))) </div>
To Retrieves an array of the values of the constants in a enumeration, we can use the Enum.GetValues() method.