Feeds:
Posts
Comments

Archive for September, 2007

Javascript to Allow only numbers in TextBox
======================================
<script language=”javascript” type=”text/javascript”>
function CheckKeyCode(e)
{
if (navigator.appName == “Microsoft Internet Explorer”)
{
if((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode == 8))
{
return true;
}
else
{
return false;
}
}
else
{
if ((e.charCode >= 48 && e.charCode <= 57) || (e.charCode == 0))
{
return true;
}
else
{
return false;
}
}
}
</script>
// Add this code in your GridView control’s RowDataBound Event.
((TextBox)e.Row.FindControl(“txtDispOrder”)).Attributes.Add(“onkeypress”, “javascript:return CheckKeyCode(event);”);
 

Read Full Post »

In Enterprise Library 3.0, the Data Access Application Block now supports batch updates functionality. This helps us to eliminate number of roundtrips with the Database.  
 The syntax for the update dataset is as follows 
Database.UpdateDataSet(DataSet dataSet, string tableName,
    DbCommand insertCommand, DbCommand updateCommand,
    DbCommand deleteCommand, UpdateBehavior updateBehavior,
    int? updateBatchSize);
Consider one table named Student as follows 
Studentid , Name, Address, [...]

Read Full Post »

Convert a string to Proper Case
===========================

// Use this Namespace
using System.Globalization;
// Code
string myString = “thIS is tHE sAmple tExt to shoW tHIs examPle !!”;
TextInfo TI = new CultureInfo(“en-US”,false).TextInfo;
Response.Write (TI.ToTitleCase( myString ));

Read Full Post »