Deprecated: Assigning the return value of new by reference is deprecated in /home/tryangle/public_html/blog/wp-includes/cache.php on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /home/tryangle/public_html/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/tryangle/public_html/blog/wp-includes/theme.php on line 507

Deprecated: Assigning the return value of new by reference is deprecated in /home/tryangle/public_html/blog/wp-content/plugins/codesnippet/codesnippet.php on line 248
Tryangled Dev » 2007 » October

Archive for October, 2007

How to add extra control in your VS.NET?

Monday, October 29th, 2007

To Add extra Control in your VS.NET do following steps.

1. Open your own project inside Visual Studio .NET.

2. Open the file containing the form you wish to add the control(s) to.

3. Right click on the Toolbox and select “Customize Toolbox”.
4. Click on the .NET Components tab.
5. Click the Browse button and select the AMS.TextBox.dll file.
6. The 9 controls will be added to the Customize toolbox and will be check marked. Click

on the Namespace column to sort by it, so you can see them more easily.
7. If you wish, remove the checkmark from the ones you’re not going to use.
8. Click OK. The controls will then appear on the toolbox.
9. Drag and drop them to your form and use them like regular TextBoxes.
10. The behavior-related properties will appear under the Behavior category in the Properties toolbox of the form designer.

Posted by Mahesh ( Tryangled )

how to create Numeric and String only Textbox control in ASP.NET?

Monday, October 29th, 2007

The TextBox accept only numeric Values using following steps in ASP.NET

1. select Textbox control and drag in to Web Page.

2.Select “RegularExpressionValidator ” Control and paste in to Web Page.

3.Right Click->RegularExpression Control and select Property.

4. Set the following Validation Expression

//is numeric validation

([0-9])*

//String Validation

([a-z])*([A-Z])*

5. Run

Posted by Mahesh ( Tryangled )

how to find interval between two dates in PHP?

Wednesday, October 24th, 2007

To Simple way to find interval between to current date and exiting date using following code.

Sample Code:

$date1=21-06-2007;

$datediff=floor((mktime()-strtotime($date1))/86400)*(-1);

echo “Date Interval”.$datediff;

Posted by Mahesh ( Tryangled )

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 )

How to retain the value of check boxes using array ?

Thursday, October 18th, 2007

If we have 4 or more check boxes . then it is little difficult to maintain different names for checkboxes.

the best way is to use array as name of checkbox.  (in_array function)
Example :
<input name=”n1[]” value=”Art” type=”checkbox” <? if (in_array(”Art”,$_POST[n1])) echo “checked”; ?>> Art<br>
<input name=”n1[]” value=”Fashion” type=”checkbox” <? if (in_array(”Fashion”,$_POST[n1])) echo “checked”; ?>> Fashion<br>
<input name=”n1[]” value=”Film” type=”checkbox” <? if (in_array(”Film”,$_POST[n1])) echo “checked”; ?>> Film<br>
<input name=”n1[]” value=”Music” type=”checkbox” <? if (in_array(”Music”,$_POST[n1])) echo “checked”; ?>> Music<br>

so when you post now the checks will be retained.

Posted by Suresh B

How to crop a paragraph to a limited text?

Wednesday, October 17th, 2007

here is the function:

function CropSentence ($strText, $intLength, $strTrail)
{
$wsCount = 0;
$intTempSize = 0;
$intTotalLen = 0;
$intLength = $intLength - strlen($strTrail);
$strTemp = “”;
if (strlen($strText) > $intLength) {
$arrTemp = explode(” “, $strText);
foreach ($arrTemp as $x) {
if (strlen($strTemp) <= $intLength) $strTemp .= ” ” . $x;
}
$CropSentence = $strTemp . $strTrail;
} else {
$CropSentence = $strText;
}
return $CropSentence;
}

to call the function

$strTemp = CropSentence($r[”event_description”], 150, “…”);

Posted by Suresh B

how to scale a image to a give height and width?

Thursday, October 11th, 2007

to call the function

$img_prop=try_img_scale(”admin/uploads/1.jpg”,200,200);

function defenition

function try_img_scale($img_path, $width, $height)
{
$img_prop=getimagesize($img_path);
$img_width=$img_prop[0];
$img_height=$img_prop[1];
if($img_width>$width || $img_height>$height)
{
$scale_width=($width/$img_width)*100;
$scale_height=($height/$img_height)*100;
if($scale_width <= $scale_height)
$scale_val=$scale_width;
else
$scale_val=$scale_height;

//$scale_val=$scale_width < $scale_height?$scale_width:$scale_height;
$img_prop[0]=($scale_val/100)*$img_width;
$img_prop[1]=($scale_val/100)*$img_height;
}
return $img_prop;
}

Posted by Suresh B

Multiview Control in ASP.NET?

Thursday, October 4th, 2007

Dotnet Samples-ASP.NET Multiview control

Posted by Mahesh ( Tryangled )