Skip to main content

Posts

Showing posts from October, 2013

JQuery Event for user pressing enter in a textbox?

$ . fn . pressEnter = function ( fn ) { return this . each ( function () { $ ( this ). bind ( 'enterPress' , fn ); $ ( this ). keyup ( function ( e ){ if ( e . keyCode == 13 ) { $ ( this ). trigger ( "enterPress" ); } }) }); }; //use it: $ ( 'textarea' ). pressEnter ( function (){ alert ( 'here' )})   Ref : http://stackoverflow.com/questions/6524288/jquery-event-for-user-pressing-enter-in-a-textbox

Pass array to mvc Action via AJAX - MVC

$ . ajax ({ url : 'controller/myaction' , data : JSON . stringify ({ myKey : myArray }), success : function ( data ) { /* Whatever */ } }); Then your action method would be like so: public ActionResult ( List <int> myKey )   {   // Do Stuff     } For you, it looks like you just need to stringify your values. The JSONValueProvider in MVC will convert that back into an IEnumerable for you.  Ref : http://stackoverflow.com/questions/5489461/pass-array-to-mvc-action-via-ajax/5489511#5489511 OR public ActionResult test(string data) { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); object obj = serializer.DeserializeObject(data); } var data = JSON.stringify({ AccountType: $("#AccountType").val(), P_FirstName: $('#P_FirstName').val() }); $.ajax({ type: "GET", url: "Home/test", data: { data: data }, .... });

Kendo UI - Nested ClientTemplates not working

=================================================== #= firstName# (Bind main Grid) =================================================== \\#=Media\\# (Bind data in Sub-grid) =================================================== @(Html.Kendo().Grid<DbModels.Test>()                                             .Name("grdTest")                                             .Columns(columns =>                                             {                                                 columns.Template(e => { }).ClientTemplate("<i...