Tuesday, June 11, 2013

How to Pass Multiple Parameters to Controller in MVC

There are several ways that we can implement this. I came across this because I had to pass 5 parameters to controller in my scenario. I got the solution using Ajax call inside the Jquery function. The Jquery function is as below. Here I got all the values from UI controls using Jquery selectors and insert all of them in to javascripts array like this the left side fields are same as the action parameters. Inside the ajax call the parameter values which are ready to be passed should convert into Json format. To convert into real object types, you should use the contentType: 'application/json; charset=utf-8', iside the ajax call. Finally I created the controller action method and it worked fine in the development environment. By using this method you can pass number of parameters to the controller action from the view. If you have any suggestions please leave a comment. Thank you.

How to Add an Image on a Hyperlink in a Kendo UI Grid Column

This is really interesting topic on developing Asp.net MVC applications. It is very easy to use Kendo UI grid with MVC and provides more functionality other than a normal grid. To reach the goal first we need to have a hyperlink column in our grid. This can be done using the ClientTemplate in the column. You can see it below. Inside the href tag you can add an image tag and give the particular image there. In hyperlink click event you can also pass data to controller. Inside the action link you can set the controller name and the action name there. Here the Id property pass as the action parameter. It is the value which is bound to the particular column. If you have any suggestions please leave a comment. Thank you.