本文介绍了如何在asp.net C中的rowcommand gridview中的codebehind中获取确认框#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 请帮助我如何在gridview的行命令事件中对确认框执行操作 我的代码如下: 受保护 void grdvwRecomm_RowCommand( object sender,GridViewCommandEventArgs e) { string filename = ; string meetingfile = grdvwRecomm.DataKeys [Convert.ToInt32(e.CommandArgument.ToString())]。值[ 1 ]的ToString(); string newid = grdvwRecomm.DataKeys [Convert.ToInt32(e.CommandArgument.ToString())]。值[ 0 ]的ToString(); string scrpcd = grdvwRecomm.DataKeys [Convert.ToInt32(e.CommandArgument.ToString())]。值[ 4 ]的ToString(); string subtype = grdvwRecomm.DataKeys [Convert.ToInt32(e.CommandArgument.ToString())]。值[ 5 ]的ToString(); string strUrl = ConfigurationManager.AppSettings [ downloadPath]的ToString(); if (e.CommandName == cmdLock) { if (subtype == CCM) { ScriptManager.RegisterClientScriptBlock(Page, typeof (页面), 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(,< 脚本 > alert('请输入您的投资组合帐户中的脚本。'); < / script > ); } else if(ds.Tables [0] .Rows [0] [Msg]。ToString()==PLEASE PROCEED) { Page.RegisterStartupScript(,< script > alert('文件可供下载。'); < / script > ); } else if(ds.Tables [0] .Rows [0] [Msg]。ToString()==你没有被IIAS团队批准) { Page.RegisterStartupScript(,< script > alert('文件不是免费的。'); < / script > ); } 其他 { Page.RegisterStartupScript(,< script > alert('您已超出限制。'); < / script > ); } } } 请告诉我如何检查确认框是或否的值,因为我的函数应该被调用并在数据集中更新解决方案 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 解决方案 这篇关于如何在asp.net C中的rowcommand gridview中的codebehind中获取确认框#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 20:17