Wednesday, December 31, 2014

kendo ui template Password texbox field


For password field you can use this:

 <input style="margin-left:10px" class="k-textbox single-line password" data-bind="value: Password" data-val="true" data-val-required="Password required" id="Password" name="Password" type="password" value="" />  

Tuesday, December 30, 2014

kendo ui grid template check null value and set empty value

if you want to check null value in kendo UI grid template you can use this.

  <dt>Student Id:</dt> #= StudentId != null ? StudentId : '' #  

Monday, December 15, 2014

kendo ui datetimepicker to C# converting value



Get value

 entity.ExpiredDate = ParseDate(model.ExpiredDate);  
 private static DateTime ParseDate(string input)  
     {  
       return DateTime.ParseExact(input, formats, CultureInfo.InvariantCulture, DateTimeStyles.None);  
     }  
  private static string[] formats = new string[]  
   {  
     "MM/dd/yyyy HH:mm:ss tt",  
     "MM/dd/yyyy HH:mm:ss",  
     "M/dd/yyyy H:mm:ss tt",  
     "M/dd/yyyy H:mm:ss"  ,  
     "MM/dd/yyyy hh:mm tt"  
   };  


Set Value

 viewModel.ExpiredDate = entity.ExpiredDate.ToString("MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture);       

kendo ui grid template if else

Use if else condition in kendo  UI template

 <script type="text/x-kendo-template" id="template">  
               <div id="details-container">  
                 <dt> Name:</dt> #= Name #  
                <br>   
                 <dt>Selected Device: </dt> iOS:-# if (PushToiOS == true) { #Yes# } else { #No# } #,  
                               Android:-# if (PushToAndroid == true) { #Yes# } else { #No# } #,  
                               WP:-# if (PushToWP == true) { #Yes# } else { #No# } #  
                <br>  
                 <dt>Expire Date:</dt> #= kendo.toString(ExpiredDate, "MM/dd/yyyy") #  
                <br>  
               </div>  
       </script>  


Sunday, December 14, 2014

Javascript Yes / No confirm dialog

You can see this

  function Remove(ctrl) {   
    if (confirm('Pressing OK will delete this record. Do you want to continue?') == false) {   
     return false;   
    }   
    var row = $(ctrl).parent().parent().parent().children().index($(ctrl).parent().parent());   
  //  alert(row);   
    $("#refRowIndex").val(row);   
    var form = $("#frmStudentDetails");   
    var serializedForm = form.serialize();   
    var url = "/Student/RemoveStudentDetails";   
    $.post(url, serializedForm, function (result) {   
     $("#divStudentDetails").html(result);   
    }, "html");   
    return false;   
   }   


Custome command in kendo UI Grid toolbar


   toolbar: [  
           {  
             name: "Add",  
             text: "Make Passive 3 Times Unsuccesful Ones",  
             click: function (e) { console.log("foo"); return false; }  
            }  
         ],  

in the grid script

   $(".k-grid-Add", "#DefaultGrid").bind("click", function (ev) {  
                    $.ajax({  
                      type: "POST",  
                      url: "http://localhost/Notifier/Devices/MakePassive/model",  
                      contentType: "application/json; charset=utf-8",  
                      dataType: "json",  
                      async: false,  
                      success: function (data) {  
                        //ev.success();  
                        if (data.ResponseCode == 800) {  
                          ev.success();  
                        } else {  
                          alert(data.ResponseMessage);  
                        }  
                      }  
                    });  
                    mAKendoGridRefresh();  
                  });  


Tuesday, December 9, 2014

kendoDropDownList json datasource

if you want to load your kendoDropDownList  from json we service you can follow this

script

  $('#Branchs').kendoDropDownList({  
                       // optionLabel: "Select branch...",  
                       dataTextField: "text",  
                       dataValueField: "value",  
                       change: function () {  
                         e.model.BranchRef = this.text();  
                       },  
                       dataSource: {  
                         transport: {  
                           read: function (e) {  
                             $.ajax({  
                               url: 'http://localhost/Notifier/Branches/GetDropDown/token',  
                               type: 'GET',  
                               dataType: 'json',  
                               success: function (data) {  
                                 {  
                                   e.success(data);  
                                 }  
                               },  
                             });  
                           }  
                         }  
                       }  
                     });  

service call

  [HttpGet]  
     [Route("GetAll/{SecurityToken}")]  
     public HttpResponseMessage GetAllBranches(string SecurityToken)  
     {  
       
       List<BranchDTO> Branches = BranchService.GetAllBranchDTO(database, false);  
       return Request.CreateResponse<List<BranchDTO>>(HttpStatusCode.OK, Branches);  
     }  


Monday, December 1, 2014

How do you add a user in TFS 2012

Just follow the image.






Now select user for your tfs member & press ok, you will get all the user in member assign in the browser.





SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...