Click here to Skip to main content
15,886,083 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please help me how to perform action on confirm box in row command event of gridview

My Code is as below:

C#
protected void grdvwRecomm_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string filename = "";
        string meetingfile = grdvwRecomm.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values[1].ToString();
        string newid = grdvwRecomm.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values[0].ToString();
        string scrpcd = grdvwRecomm.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values[4].ToString();
        string subtype = grdvwRecomm.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values[5].ToString();
        string strUrl = ConfigurationManager.AppSettings["downloadPath"].ToString();


               if (e.CommandName == "cmdLock")
        {
            if (subtype == "CCM")
            {
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "script", "ChkCCM();", true);
                UpdateCounter(strNewId, scrpcd, newid);
            }
            else
            {
                UpdateCounter(strNewId, scrpcd, newid);
                BindData(strNewId);
            }
        }
    }

XML
protected void UpdateCounter(string regid,string scripcd,string newid)
   {
       SqlParameter[] objprm = new SqlParameter[3];
       objprm[0] = new SqlParameter("@REG_NEW_ID", SqlDbType.VarChar);
       objprm[0].Value = regid;
       objprm[1] = new SqlParameter("@SCRIP_CODE", SqlDbType.VarChar);
       objprm[1].Value = scripcd;
       objprm[2] = new SqlParameter("@NEW_ID", SqlDbType.VarChar);
       objprm[2].Value = newid;
       DataSet ds = SqlHelper.ExecuteDataset(strCon, CommandType.StoredProcedure, "USP_UPDATE_REPORT_CNT", objprm);
       if (ds.Tables.Count > 0)
       {
           if (ds.Tables[0].Rows[0]["Msg"].ToString() == "NOT SUBSCRIB")
           {

               Page.RegisterStartupScript("", "<script>alert('Please Enter the Scrip into your Portfolio Account.');</script>");
           }
           else if (ds.Tables[0].Rows[0]["Msg"].ToString() == "PLEASE PROCEED")
           {

               Page.RegisterStartupScript("", "<script>alert('File is Available for Download.');</script>");
           }
           else if (ds.Tables[0].Rows[0]["Msg"].ToString() == "YOU HAVE NOT APPROVE BY IIAS TEAM")
           {
               Page.RegisterStartupScript("", "<script>alert('File is Not Free.');</script>");
           }

           else
           {
               Page.RegisterStartupScript("", "<script>alert('You have exceeded your limits.');</script>");

           }
       }
   }




Please let me know how can i check the value of confirm box "yes or no" on base of that my function should get called and update in dataset
Posted

1 solution

Try This It works,
before page rendering

C#
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mse", "ChkCCM();", true);


this works after page rendering,

C#
ScriptManager.RegisterStartupScript(this, this.GetType(), "Mse", "ChkCCM();", true);
 
Share this answer
 
Comments
priti2010 16-Mar-13 3:32am    
how to get the value of confirm box so that i can call function as mention earlier
Nandakishore G N 16-Mar-13 7:58am    
what have you written in your function ChkCCM() ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900