Google


Earn money without investing 1$

lovebird-mails.com lovebird-mails.com

Wednesday, August 8, 2007

Difference between Cloning and Copying(Very Important)

Copy will copy the structre as well as Data to another object.

Clone will create a copy of that structure with default values.
class object{
public int i = 0;
public object(){
}
}

Object ob1 = new Object();
ob1.i = 4;
Response.write(ob1.i);//Result 4
Object ob2 = ob1;
Response.write(ob2.i);//Result 4
Object ob3 = ob1.clone();
Response.write(ob3.i);//Result 0.

How to use Query string in our program?

webform1.aspx?id="+somevalue what u want to send+";

It is seen in the url when u redirect to other page.It is seen in the url of the site.
To store the querystring u have write some code in the page itself as mentioned below
string str = QueryString["id"];

Download XML notepad

Download XML notepad from here

http://www.microsoft.com/downloads/details.aspx?FamilyID=72d6aa49-787d-4118-ba5f-4f30fe913628&DisplayLang=en

Some useful javascript function using regular expression

Most of the time we require to validate the control in the client side using javascript.Below are some useful function


For removing blank spaces with regular Expression-----------------------

function trimAll(value)
{
var temp = value;
var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
if (obj.test(temp))
{
temp = temp.replace(obj, '$2');
}
var obj = / +/g;
temp = temp.replace(obj, " ");
if (temp == " ")
{
temp = "";
}
return temp;
}

For Zip code validation US Zip Code------------------------------------------

function isValidZipCode(val)
{
var exp=/(^\d{5}$)(^\d{5}-\d{4}$)/;
var re = new RegExp(exp);
return (val.match(re));
}

For checking Alphanumeric value-----------------------------------
function CheckAlphanumeric (e)
{
var key;
key = e.which ? e.which : e.keyCode;
if((key>=48 &&amp; key<=57)(key>=65 && key<=91) (key >=97 && key<=123)) {
e.returnValue= true;
}
else
{
alert("please enter Alphanumeric only");
e.returnValue = false;
}
}
Time in 12 hour foramt-----------------------------------------------

function validateTime(strValue,state)
{
var objRegExp = /^([1-9]1[0-1]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/;
if(!(objRegExp.test( strValue )))
{
alert("Please Enter "+ state +" time in 12 hour format eg 11:30 ");
}
return objRegExp.test( strValue );
}

Hope this will help all

Review Books

  • ASP.NET WebService
  • Learn VisualStudio.net
  • Basic .NET Framework
  • Basic C#
  • .NET Interview Questions
  • C# 2005 Programming