Skip to main content

Posts

Kendo UI Grid Only Expand One Row at a Time

detailExpand function -------------------------------------- var grd = "#dvGrid"; $(grd).kendoGrid({                     dataSource: donorData,                     detailInit: detailInit,                     detailExpand: function (e) {                         $(grd + " tr.k-detail-row").hide();                         $(grd + " tr.k-master-row").find(".highlightrow").removeClass("activerow");              ...

Return value from function with an Ajax call [duplicate] (Jquery : call ajax and return value in function)

Jquery Code <script src="jscripts/jquery-1.7.2.min.js" type="text/javascript"></script>     <script type="text/javascript">         test();         function test() {             alert('Call Ajax Function');             myFunction(function (d) {                 //processing the data                 alert("Return Datetime from Ajax Request. The Datetime is : " + d);             });             alert('Done');         }         function myFunction(callba...

login with google in .net

public static class GoogleAuthenticationApi     {         public static string GetAuthenticationToken(string userName, string password, out bool isUserValid)         {             string response = GoogleRequestHelper.GetPostResult("https://www.google.com/accounts/clientlogin", String.Format("accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=lh2&souce=sourceappname", userName, password), out isUserValid);             if (response.Contains("Auth="))             {                 foreach (string line in response.Split(Environment.NewLine.ToCharArray()))                 { ...

Get the number of calendar weeks between 2 dates in C#

1. const int firstDayOfWeek = 0;  // 0 = Sunday int wasteDaysStart = (7 + Convert.ToInt32(first.DayOfWeek) - firstDayOfWeek) % 7; int diff = (int)(((last - first).TotalDays + wasteDaysStart + 6) / 7); diff = diff + 1; ==================================================== 2. DateTime periodStart = first; DateTime periodEnd = last; const DayOfWeek FIRST_DAY_OF_WEEK = DayOfWeek.Monday; const DayOfWeek LAST_DAY_OF_WEEK = DayOfWeek.Sunday; const int DAYS_IN_WEEK = 7; DateTime firstDayOfWeekBeforeStartDate; int daysBetweenStartDateAndPreviousFirstDayOfWeek = (int)periodStart.DayOfWeek - (int)FIRST_DAY_OF_WEEK; if (daysBetweenStartDateAndPreviousFirstDayOfWeek >= 0) firstDayOfWeekBeforeStartDate = periodStart.AddDays(-daysBetweenStartDateAndPreviousFirstDayOfWeek); else firstDayOfWeekBeforeStartDate = periodStart.AddDays(-(daysBetweenStartDateAndPreviousFirstDayOfWeek + DAYS_IN_WEEK)); DateTime lastDayOfWeekAfterEndDate; int daysBetweenEndDateAndFollowingLast...

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...