I am using Asp.Net MVC Kendo Grid. While doing sorting, I am not getting anything on FormCollection at controller. But all other postbacks other than kendo controllers sends FormCollection to the controller. Please advice.
If your DataSource is set to use HTTP GET then the FormCollection would be empty.
Inside your MVC controller you could use var x = Request["paramName"]; instead, which would get you values sent to the server whether GET or POST was used.
The Read method on Kendo Grid can be used for doing anything related to Kendo Grid like Sorting or Paging etc..Even postback is not required when doing sorting on Kendo Grid. In new dll of Kendo,
everythin can be done without doing postback.
Related
i have 7 viewBags which holds data in view when the Page Reload (switch to another language ) the ViewBag value became empty
how to keep values of these viewBags after Page reload
i'm using asp.net mvc 5
ViewBag is just for passing from controller to view. You would want to use Session state if you want to persist data on post backs.
Is there a way to define the parameterMap option for a Kendo UI Grid via the server side ASP.NET MVC wrappers?
I need to change local time into UTC time before sending up a filter command to the server, and this appears to be the only way to do it.
Sort of...
You can specify a string as the parameterMap setting, and this string can either be a JavaScript function directly, or the name of a JavaScript function that is found on the page.
.parameterMap("myParamMapFunction");
or
.parameterMap("function(data){ /* do stuff with the data */}");
I am working with knockout and jquery with asplnet mvc. I apply bindings using knockout from the json object returned in a controller. This is a applied to my markup.
If a user clicks on a button on screen, I make a call to the controller action and retrieve the data from the server again.
At this point, do I need to rebind my new json object to knockout or how is it handled?
I am assuming that when a user clicks the button and makes a call to the controller action, you are doing this as an AJAX postback and not as a full page refresh. If this is correct, then no, you do not need to rebind your new json object. You just need to use your new json object to update your view model and knockout will take care of the rest. The way it works is as follows:
When your page initially loads, your page has a javascript object returned from your controller. If this object is turned into a corresponding object in which all of the properties are knockout observables and observableArrays, you can get persistent two-way databinding (i.e from the model to your page and from the page to your model) after you apply knockout bindings.
The easiest way to turn your javascript object into one in which all properties are knockout observables is to use the knockout mapping plugin. Once you have done this, you then bind this to your page using the knockout applybindings method.
So on the initial page load, this can be set up as follows:
//load your data
var data = ... some code to retrieve your data
//convert this into a viewmodel having knockout observables as properties
MyPage.ViewModel = ko.mapping.fromJS(data);
//bind this viewmodel to all knockout bindings
ko.applyBindings(MyPage.ViewModel);
Now when an AJAX call is made and new data is retrieved, when you update the ViewModel, knockout will automatically update the UI:
//AJAX call is made
var newdata = ... results from AJAX call
//Update viewmodel
MyPage.ViewModel.Property1(newdata.Property1);
MyPage.ViewModel.Property2(newdata.Property2);
...other properties...
...UI is automatically updated by knockout
Once the viewmodel is updated, the UI will automatically refresh thanks to knockout's two-way databinding. So you just need to update your viewmodel, and knockout will automatically apply its bindings and take care of updating the UI.
I m working on asp.net mvc application.
i have one partial view in that one submit form and click on submit button than data will stored in database.
but when i get data from form collection than that form collection come null so how can i get partial view control's value in action method?
thanks in advance..
note : partial view is not strongly type.
I think you encounter the same issue that is discussed here:
ASP.NET MVC partial views: input name prefixes
To quickly investigate the issue, look at the source code of your page: do your controls from partials have the names you expect? If not, the article above will be helpful.
I'm creating a search page, the page has a form that is being submitted using Ajax, after the search is performed I want to display a grid with the results.
My question is, should I create the grid when the page loads and then fill it with the data after the search is performed, or create the grid on the server when the search is performed and then just append the grid to the page.
I was thinking on creating a helper method to render the grid and invoking it from the controller after it gets the results, then returning the result of the helper method and appending it to the page, but this might be against MVC architecture (I'm defining UI on the controller).
What approach should I take?
Thanks
for the grid creation, you can have a look at MVCContrib grid helper
You could use jqGrid (http://www.trirand.com/blog/) or Flexigrid (http://www.flexigrid.info/) and load data with ajax and json. You submit search form with ajax, controller returns JsonResult, and then you load it into grid in callback. It is easy to implement and gives you additional functionalities (sorting and much, much more). Here you have some demos:
http://trirand.com/jqgrid/jqgrid.html