Saturday, 5 October 2013

How to clear FileUpload Control data using JavaScript in ASP.NET


In this article I will explain How to clear FileUpload Control data using JavaScript in ASP.NET

To clear file upload control in JavaScript we need to write the following code your page

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title>validate fileupload control using Jquery in ASP.NET</title>
<script language="javascript" type="text/javascript">
function ClearFileUploadControl() {
var uplctrl = document.getElementById("fileupload1");
uplctrl.select();
clrctrl = uplctrl.createTextRange();
clrctrl.execCommand('delete');
uplctrl.focus();
}
</script>
</head>

How to get ASP.NET Label and TextBox values in JavaScript


 In this article I will explain How to get ASP.NET Label and TextBox values in JavaScript

Get Asp.net Textbox And Label Value in JavaScript

To get ASP.NET textbox or label value in JavaScript we need to write a code like as shown below

Get label value
var Name = document.getElementById("<%=lblName.ClientID %>").innerHTML

Get label value

var LastName = document.getElementById("<%=txtLastName.ClientID %>").value;

Friday, 4 October 2013

How to write code for Jquery modal popup in asp.net


In this article I will explain How to apply CSS to model popup? And How to design Model popup window?
Below is the design for model popup code. Copy and paste it into your ASPX page and check.
<html>
<head>
<title>jQuery Popup Dialog - Click</title>
<style type="text/css">
#overlay {
positionfixed;
top0;
left0;
width100%;
height100%;
background-color#000;
filter:alpha(opacity=70);
-moz-opacity:0.7;
-khtml-opacity0.7;
opacity0.7;
z-index100;
displaynone;
}
.content a{
text-decorationnone;
}
.popup{
width100%;
margin0 auto;
displaynone;
positionfixed;
z-index101;
}

How to write code for Jquery KeyPress, KeyDown, KeyUp Events with examples? What are the differences?


In this article I will explain How to write code for Jquery KeyPress, KeyDown, KeyUp Events with examples? What are the differences? 

KeyDown or KeyPress Events

KeyDown or KeyPress both the events are same both will rise whenever we click any button for that we need to write the code like as shown below

How to get session variable value using Jquery in asp.net


In this article I will explain How to get session variable value using Jquery in asp.net?

Get Session Variable value in jQuery

To get session variable value in Jquery we need to write the code like as shown below

var FirstName = '<%= Session["UserID"] %>'

In above code Session["UserID"] is the value what we set in session. If you want to see it in complete example check below code

Email validation with Regular Expression using C#



In this article I will explain how to validate Email with Regular expression in C#.NET

To validate email address we need to write the regular expression like this


bool isEmail = Regex.IsMatch(txtEmail.Text.Trim(), @"\A(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\Z");

If you want to see it in complete example write the following code in your aspx page like as shown below

Thursday, 3 October 2013

Difference between Array and Arraylist in c# with example


In this article I will explain what is Array? And what is ArrayList? And what are the differences?  

Arrays

Arrays are strongly typed collection of same datatype and these arrays are fixed length that cannot be changed during runtime. Generally in arrays we will store values with index basis that will start with zero. If we want to access values from arrays we need to pass index values.

Arrays declaration:

We will declare arrays with fixed length and store values like as shown below

string[] arr=new string[3];
arr[0] = "welcome";
arr[1] = "To";
arr[2] = "Vatturidotnet";