Hi,
I am using Grid View Template field(Check Box) for delete a row, but i need a message box(OK/Cancle) should display before deleting the row.My C# Code like this for deleting the row when we click on check box of grid view.
protected void CheckBox2_Check edChanged(objec t sender, EventArgs e)
{
CheckBox chk = (CheckBox)sende r;
GridViewRow row = (GridViewRow)ch k.NamingContain er;
if (chk.Checked == true)
{
string str = Convert.ToStrin g(row.Cells[3].Text).Trim();
string str1 = Convert.ToStrin g(row.Cells[4].Text).Trim();
string str2 = Convert.ToStrin g(row.Cells[6].Text).Trim();
string StrSql = "Update AppointmentMast er set status='" + 0 + "' where LastName='" + str + "' and FirstName='" + str1 + "' and dob='" + str2 + "'";
int intResult = ObjDat.ExecuteS QL(StrSql);
string Appdel = "select * from AppointmentMast er where Status='"+1+"'" ;
DataSet ds = objDAL.GetInfo( Appdel);
GridView1.DataS ource = ds;
GridView1.DataB ind();
}
}
And my Js function for displaying message like this
function MsgOkCancel()
{
var fRet;
fRet = confirm('Are you sure?');
alert(fRet);
if(fRet==true)
{
;
//alert("done")
}
if(fRet==false)
{
//alert("not done")
}
}
But i am not able to combine these two that is When i select the Check Box in Grid View the js function shoud call. Please help me to solve this problem.
I am using Grid View Template field(Check Box) for delete a row, but i need a message box(OK/Cancle) should display before deleting the row.My C# Code like this for deleting the row when we click on check box of grid view.
protected void CheckBox2_Check edChanged(objec t sender, EventArgs e)
{
CheckBox chk = (CheckBox)sende r;
GridViewRow row = (GridViewRow)ch k.NamingContain er;
if (chk.Checked == true)
{
string str = Convert.ToStrin g(row.Cells[3].Text).Trim();
string str1 = Convert.ToStrin g(row.Cells[4].Text).Trim();
string str2 = Convert.ToStrin g(row.Cells[6].Text).Trim();
string StrSql = "Update AppointmentMast er set status='" + 0 + "' where LastName='" + str + "' and FirstName='" + str1 + "' and dob='" + str2 + "'";
int intResult = ObjDat.ExecuteS QL(StrSql);
string Appdel = "select * from AppointmentMast er where Status='"+1+"'" ;
DataSet ds = objDAL.GetInfo( Appdel);
GridView1.DataS ource = ds;
GridView1.DataB ind();
}
}
And my Js function for displaying message like this
function MsgOkCancel()
{
var fRet;
fRet = confirm('Are you sure?');
alert(fRet);
if(fRet==true)
{
;
//alert("done")
}
if(fRet==false)
{
//alert("not done")
}
}
But i am not able to combine these two that is When i select the Check Box in Grid View the js function shoud call. Please help me to solve this problem.
Comment