Display Ok/Cancel Message in gridview template(check Box).

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shaileshsharma
    New Member
    • Jun 2007
    • 26

    Display Ok/Cancel Message in gridview template(check Box).

    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.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Have you tried attributes.add( )?

    Comment

    • Shaileshsharma
      New Member
      • Jun 2007
      • 26

      #3
      yes i have tryed attribute .add like this

      controlname.att ribute.add("Nam e of JS function") but it is not working

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        Usually the syntax is attribute.add(" event","functio n name"). HTH.

        Comment

        Working...