Client Side between HTML Head tags
.................................
Inside of Head (after Title)
script language="javascript" type="text/javascript">
function getconfirmation(str)
{
if (confirm(str)==true)
return true;
else
return false;
}
script>
...............
In Grid
..............
protected void gvAdressProof_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbtnDelete = new LinkButton();
lbtnDelete = (LinkButton)e.Row.Cells[2].FindControl("lbtnDelete");
string str = "Are you sure to delete?";
lbtnDelete.Attributes.Add("OnClick", "return getconfirmation('" + str + "');");
}
}
.................
If Details View
..................
protected void dvUser_ItemCreated(object sender, EventArgs e)
{
if (dvUser.CurrentMode == DetailsViewMode.ReadOnly && dvUser.Rows.Count > 0)
{
LinkButton lbtnDelete = new LinkButton();
lbtnDelete = (LinkButton)dvUser.FooterRow.FindControl("lbtnDelete");
string str = "Are you sure to delete?";
lbtnDelete.Attributes.Add("OnClick", "return getconfirmation('" + str + "');");
}
}
}
Saturday, February 7, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment