how to get confirm box in codebehind in rowcommand gridview in asp.net C#

Posted by Priti2010 under ASP.NET on 3/16/2013 | Points: 10 | Views : 2345 | Status : [Member] | Replies : 1
Please help me how to perform action on confirm box in row command event of gridview

My Code is as below:

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);
}
}
}

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

Thanks & Regards
Priti



Responses

Posted by: Jayakumars on: 3/16/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
pirit
refer this

http://www.codeproject.com/Articles/12666/GridView-Delete-with-Confirmation
http://forums.asp.net/t/1253029.aspx/1

Mark as Answer if its helpful to you

Priti2010, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response