21 August 2008

Disable the back functionality of the browser

//disable the back functionality of the browser
window.history.forward(1);

04 August 2008

How to change a value in GridView

protected void grvTest_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[8].Text == "True")
{
e.Row.Cells[8].Text = "Active";
}
else
{
e.Row.Cells[8].Text = "Inactive";
}
}
}

Allow only floating point values in textbox

function isNumberPointKey(evt)
{
//alert(event.keyCode);
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48
or
charCode > 57) && charCode!=46 )
return false;
return true;
}

onkeypress="return isNumberPointKey(event

Assigning a value to textbox when TextMode is Password

TextBox1.Text = "test";
TextBox1.Attributes.Add("value", "test");