Skip to main content

Posts

Showing posts from March, 2013

Javascript function to validate html select or drop down list

Introduction: In my previous article I have explained about Code used to How to show confirmation message while deleting grid view row . In this article I am going to explain about how validate drop down list or html select using Javascript . Explanation: For the explanation purpose I have a select list which contains city list along with select city as items. While clicking on the button it will check the selected index of the select. If it is 0 then it will show the alert as city is not selected. Else it will show the message as city is selected.

How to show confirm message while deleting grid view row.

Introduction: In my previous article I have explained about Code used to How to generate random strings/passwords using c#.net . In this article I am going to explain about how to show the confirmation message while deleting the row from the grid view using c#.net . Explanation: For the explanation purpose I have created table with cities named tempCities and created two procedures one for inserting and another one for deleting.

How to create Generate random string using C#.Net, Asp.Net |Code to generate random password using C#.Net, Asp.Net

Introduction: In my previous article I have explained about Code used to Convert numbers into words using C#.net . In this article I am going to explain about code used to create zip, rar and gzip files using c#.net or how to compress and decompress data using c#.net . Explanation: This method is used to generate random string. You can this method to generate random passwords of specified length. For explanation purpose I have a form with a textbox to enter no of characters to generate random string. When you click on the generate button it will automatically generates the random string of specified length.

How to create zip, rar and gzip files using C#.Net, Asp.Net |Code to Compress Decompress files using C#.Net, Asp.Net

Introduction: In my previous article I have explained about Code used to Convert numbers into words using C#.net . In this article I am going to explain about code used to create zip, rar and gzip files using c#.net or how to compress and decompress data using c#.net . Explanation: This method is used to generate random string. You can this method to generate random passwords of specified length. For explanation purpose I have a form with a textbox to enter no of characters to generate random string. When you click on the generate button it will automatically generates the random string of specified length.

Code To Convert rupees(numbers) into words using C#.Net

Introduction: In my previous article I have explained about how to validate emailid using javascript . In this article I am going to explain about code used to convert rupees(numbers) into words using C#.Net . Explanation: For explanation purpose I have a page. It has a textbox to input the numbers. And when you click on the convert to words button then it will convert the input numbers into words and shows it in the below label. Below is the C# code used to do this functionality. public static string NumbersToWords( int inputNumber) {     int inputNo = inputNumber;     if (inputNo == 0)         return "Zero" ;     int [] numbers = new int [4];     int first = 0;     int u, h, t;     System.Text. StringBuilder sb = new System.Text. StringBuilder ();     if (inputNo < 0)     {         sb.Append( "Minus " );         inputNo = -inputNo;     }     string [] words0 = { "" , "One " ,

Javascript code/function to validate email id | Check Emailid is Valid

Introduction: In my previous article I have explained about How to Valiate radio button using javascript . In this article I am going to explain about code used to validate emailed using   Javascript . Explanation: For explanation purpose  I have a text input and a button in the form. If you enter the emailid and click the validate button then it will check whether it is a valid email id or not. If it is valid email id then it will show the alert msg as Valid Emailid else it will show alert msg as Invalid Emailid. Below is the javascript function to validate email id. It gets the textbox  id as input. function fnCheckEmail(id) {     var emailid = document.getElementById(id).value;     var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$$/i     if (emailfilter.test(emailid)) {         alert(emailid+ ' is a Valid EmailId..' );     }     else {         alert(emailid + ' is a InValid EmailId..' );     } } He

Javascript code/ function to validate Radio Button | Check Radio button is checked

Introduction: In my previous article I have explained about Code used to validate emailid using javascript. In this article I am going to explain about  How to remove html tags from the input string Explanation: For explanation purpose I have two radio buttons with name “gender”. While clicking on the validate button I am checking whether any one gender is selected. Below is the javascript code used to validate the radio button. function fnCheckRadio(name) {     var flag = "0" ;     var objs = document.getElementsByName(name);     if (objs) {         if (objs.length > 0) {             for ( var i = 0; i < objs.length; i++) {                 if (objs[i].checked == true ) {                     alert( "Selected Value is " + objs[i].value);                     return ;                 }             }             if (flag == "0" ) {                 alert( "Radio button is not checked.." );       

How to remove html tags from in C#.Net

Introduction: In my previous article I have explained about How to How to generate random no in C#.Net . In this article I am going to explain about how to remove html tags from the input string using C#.Net . Explanation: In this example I have used regular expressions to match the html tags and I have removed the html tags. Below method will remove html tags and will give you the text alone in the output.

How to generate random no in C#.Net

Introduction: In my previous article I have explained about How to How to Automatically change the version of css and js files in Asp.Net | C#.Net . In this article I am going to explain about how to generate random numbers using C#.Net. Explanation: Random class in System namespace is used to  generate pseudo-random number within the specified range.  For explanation purpose i have a label to show the generated random no and a button to generate the random no.

How to Automatically change the version of css and js files in Asp.Net | C#.Net

Introduction: In my previous article I have explained about how to get all files in a directory using C#.Net and Asp.Net . In this article I am going to explain about how to automatically update the version of css and js when file gets changed. Explanation: When you update JavaScript or CSS files that are already cached in users' browsers, most likely many users won’t get that for some time because of the caching at the browser. You need some way to force browser to download the latest files. There’s no way to do that effectively across all browsers unless you change the file name or you change the URL of the files by introducing some unique query string. Most web developers use the query string approach and use a version suffix to send the new file to the browser. For example: < script type ="text/javascript" src ="js/jquery-1.4.1.min.js?v=1" ></ script > < script type ="text/javascript" src ="js/myscript.