ASP.NET MVC has a really nice capability of generating client-side validation code based on the data annotations on your model. It can either generate a JavaScript code with the rules or generate data attributes on the input elements (unobtrusive). By using the second approach jQuery can read these data attributes (by the unobtrusive validation plugin) and automatically wire the validation logic up on the client. All this works great if you have a completely standard application – a user enters some input data and sends it to the server. However, if your application also requires some client-side logic along, you may consider KnockoutJS. The basic functionality of KnockoutJS, however, is not enough when input from the user is required. Fortunately, there is a plugin, which adds validation capabilities to KnockoutJS. It provides a set of rules like min, max, equals, etc., which we can use out of the box. Now the issue is how to make the data attributes, generated by ASP.NET MVC, and KnockoutJS validation play together. As I couldn’t find anything out of the box, I decided to create my own plugin. Continue Reading…
Tag Archives: javascript
Strange behavior with Silverlight when showing modal dialogs in SharePoint
Recently I have been working seriously on integrating Silverlight applications in SharePoint. I already have some experience with SharePoint but with my everyday work I discover more and more “features” of that system.
The Scenario
Everything started with a scenario I had to implement within SharePoint and ended up to be related just to Silverlight. So, my scenario involves creating a small Silverlight application, which is displayed within a web part. This application requires showing a modal dialog, which hosts another application. As my web part may be placed in small space, I preferred to use SharePoint’s dialog feature instead of using ChildWindow. Those two Silverlight applications (the one in the web part and the one in the dialog) communicate via local message infrastructure, which Silverlight provides. Continue Reading…