Tagged: Javascript


JumpStart # 15–Unobstructive Validation in ASP.Net 4.5

ASP.Net 4.5 supports UnObstructive JavaScript validation on client side with UnobtrusiveValidationMode=”WebForms” attribute on page level. With this advancement, page size will reduce drastically for a page which contains large number of validation controls.

Unobstructive Validation removes inline JavaScript which is generated by regular ASP.Net Validators, instead it uses HTML5 Data attributes to perform validation.


JumpStart # 10 – Display Validation Error Messages in different formats using JavaScript

At times, instead of normal display of validation error messages (or even in the validation summary) on the page, we tend to display them in more user friendly manner. This Jumpstart deals with the using JavaScript to get the above shown validation error display formats. The main concentration laid on especially 3 different formats – 1) Water Marking 2) Error Images (beside TextBox) and 3) Alert Dialog. The before mentioned effects can be easily achieved with some quick JavaScript. In this tutorial, we use 3 JavaScript functions to get more flexible user interactivity with the page, they are – validate(), resetValidation(event) and singleValidation(event). In the following code sample we use three simple TextBox and RequiredFieldValidator pairs to demonstrate the validation error effects.


JumpStart # 9 – Make Response.Redirect() open in New Blank Window

1) The main motive behind writing this code snippet is that this topic has been asked number of times @forums.
2) Response.Redirect() by itself never opens a page in a new blank window, so the trick lies in using the JavaScript. We use the OnClientClick property of the Button to open a new window.
3) The credit of the code goes to a MSFT (I never knew his name) for providing this sample @forums.


JumpStart # 8 – Making Client CallBacks by Implementing ICallBackEventHandler Interface

In this tutorial, we first create a Database and store the necessary details of the Images like ImageName, ImagePath (physical directory path in relative URL), ImageDescription etc. Then we display these images on the web page using a Repeater in combination with SqlDataSource. After this we use Client CallBack to display the details of corresponding image on which mouse is hovered. CallBacks are accomplished by implementing ICallBackEventHandler.


Access JavaScript Variables in Code-Behind Class

After writing the article on how to “Access Code-Behind variables in ASPX and JavaScript”, my focus continued on this particular counteract concept. At times we got to transfer some data from client side JavaScript to code-behind on some particular requirements. For example when the screen resolution of the client’s web browser is needed to be known in code-behind, then the simple way to accomplish is to access JavaScript variable in Code-Behind.Read More…


Access Code-behind variables in ASPX and JavaScript

I often come across this question not only in the Worldwide Web but also in many development scenarios. In fact this is the question which I faced when I started programming years back. At times we need to change some of the properties of the server side controls from code-behind partial class and also sometimes we are required to process some data on the client side JavaScript which we get from code-behind. In those cases, accessing code-behind variables in ASPX is the easiest way to get our job done.Read More…