Last active
          October 5, 2020 07:18 
        
      - 
      
 - 
        
Save roughiain/73410ccba0a007b7b0fbdb26ab0e41ec to your computer and use it in GitHub Desktop.  
Revisions
- 
        
roughiain revised this gist
Oct 5, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,7 @@ To tell the template to do something in JS use the `#` * Here we tell the template we need to access the value from the model using `#:`. * *Note:* The `#` again telling the template we are finished doing JS. "`</span>`" * Closing the html tag span.  - 
        
roughiain created this gist
Oct 5, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,77 @@ # Kendo Password Template with explanation. ## Model for example. ```csharp public class User { public int Id { get; set; } public string Name { get; set; } public string Password { get;set; } } ``` ## Client Template. ```csharp .... cc.Bound(c => c.Password).ClientTemplate("# if(data.Password){#" + "<span>" + "#: Array(data.Password.length).join('*')#" + "</span>" + " #} else {#" + " <span></span> " + "#}#"); ``` ## Explanation `data` = the model in JS. To tell the template to do something in JS use the `#` `# if(data.Password){#` * So we are telling template to evaluate if password is not null. * *Note:* the `{#` telling the template we are finished doing JS. `"<span>"` * Now we are telling it to write the html tag span. `"#: Array(data.Password.length).join('*')#" ` * Here we tell the template we need to access the value from the model using `#:`. * *Note:* The `#` again telling the template we are finished doing JS. "</span>" * Closing the html tag span. `" #} else {#" +` * Here we go back to JS mode and close the brace and start the else. * *Note:* The `{#` telling the template to end JS Mode `"#}#"` * Here we go back to JS Mode and close the brace then stop the template ## Refrences (https://docs.telerik.com/kendo-ui/framework/templates/overview)[https://docs.telerik.com/kendo-ui/framework/templates/overview] (https://www.telerik.com/forums/password-column-showing-in-plain-text)[https://www.telerik.com/forums/password-column-showing-in-plain-text] ### Telerik post in case they break the CMS links again. ```text Hi Shawn, As the Kendo Grid does not offer the possibility to configure a column as s "password", I would suggest you to define a ClientTemplate for the Password field to properly mask its text: columns.Bound(p => p.Password).ClientTemplate("<span>#: Array(data.Password.length).join('*') #</span>"); Regards, Veselin Tsvetanov Telerik by Progress ```