//disable the back functionality of the browser
window.history.forward(1);
21 August 2008
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";
}
}
}
{
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
{
//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");
TextBox1.Attributes.Add("value", "test");
29 July 2008
Identify GridView RowIndex
//When we Click a grdView Row, then row index stored in a hidden Field
function GetGrvPersonalRowIndex(GRVRowIndex)
{
document.getElementById('ctl00_ContentPlaceHolder1_tbcDailyReporting_TabPanel1_HFGridviewRowIndex').value=GRVRowIndex;
}
-------In server side of asp page----------
protected void grvPersonal_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "javascript:GetGrvPersonalRowIndex(" + e.Row.RowIndex + ")");
}
}
function GetGrvPersonalRowIndex(GRVRowIndex)
{
document.getElementById('ctl00_ContentPlaceHolder1_tbcDailyReporting_TabPanel1_HFGridviewRowIndex').value=GRVRowIndex;
}
-------In server side of asp page----------
protected void grvPersonal_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "javascript:GetGrvPersonalRowIndex(" + e.Row.RowIndex + ")");
}
}
Allow two decimal palace in textBox
function AllowOnlyTwoDecimalPlace(txtBox)
{
var num = parseFloat(txtBox.value);
txtBox.value = num.toFixed(2);
if (txtBox.value == 'NaN'){
txtBox.value = '';}
}
{
var num = parseFloat(txtBox.value);
txtBox.value = num.toFixed(2);
if (txtBox.value == 'NaN'){
txtBox.value = '';}
}
To Identify Gridview Row Index in Row command
GridViewRow row = ((GridViewRow)((Control)e.CommandSource).Parent.Parent);
DropDownList ddlTest= (DropDownList)row.Cells[2].FindControl("ddlTest");
DropDownList ddlTest= (DropDownList)row.Cells[2].FindControl("ddlTest");
Subscribe to:
Posts (Atom)