Archive for October 23rd, 2007

How many ways to deploy the application in ASP.NET?

Tuesday, October 23rd, 2007

To Deploy the application using following ways.

1. XCOPY Deployment.

2. using the Copy Project option in VS.NET.

3. Deployment using VS.NET Installer.

Posted by Mahesh ( Tryangled )

How to select multiple value in ListBox control?

Tuesday, October 23rd, 2007

To Select Multiple Value in ListBox Control using following code.

for each(Listitem i in Listbox1.items)

{

if(i.selected)

{

TextBox1.Text+=i.value;
}
}

Explanation:

To Create object for list box control and using one for loop to travel up to all elements of corresponding listbox control and upend all value to one textbox.

Posted by Mahesh ( Tryangled )

Performing Custom Validation in ASP.NET

Tuesday, October 23rd, 2007

Demonstrates how to use custom validation on a form by checking to see if a string in a TextBox is not the same with a string from an array (or database), case in which it displays ‘Name Already Exists’.

Start a new ASP .NET Web Application project named customValidation and drag a TextBox, a Button and a CustomValidator to WebForm1.aspx.

Now set the ErrorMessage property of CustomValidator1 to “This name is already taken”. Also set the ControlToValidate property to TextBox1.

Write following C# code in your Code behind file

string[] emp_names = { “Mahesh”, “jerson”, “Narayanan” };

public void validateName(object sender, ServerValidateEventArgs e)
{
foreach (string name in emp_names)
{

if (e.Value == name)
{

e.IsValid = false;

}

}

}

At this time we only need to set the ServerValidate event to validateName. We’ll do this using the Properties window of Visual Studio .NET:

Posted by Mahesh ( Tryangled )