本文介绍了单击gridview外部的删除按钮时,如何在删除grid视图记录之前显示确认消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gridview有单选按钮,我想在选择单选按钮后显示确认消息.


代码:


试试
{
for(int i = 0; i; grdLanguagedesc.Rows.Count; i ++)
{

RadioButton rb =(RadioButton)grdLanguagedesc.Rows [i] .FindControl(&"RowSelector& quot;);;
如果(rb.Checked == true)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(),clientScript,返回Confirm(``确定要删除此记录吗?'');, true);
//ScriptManager.RegisterStartupScript(this、this.GetType()、clientScript、confirm_delete();、true);
//Page.ClientScript.RegisterStartupScript(this.GetType(),clientScript,javascript:if(!confirm(``您是否希望完成此订单?''))返回false;);
字符串msgid = grdLanguagedesc.Rows [i] .Cells [1] .Text;
DeleteRecords(msgid);
lblError.Visible = true;
返回;
其他
{
lblError.Visible = true;
lblError.Text =请在GridView中选择记录;
btnSearch.Focus();
lnkfilter.Focus();

}
}
}



< b>
当您单击gridview外部的删除按钮时,如何在删除grid视图记录之前显示确认消息?</b>

The gridview have radio button i want to show confirm message after radio button selected.


Code:


try
{
for (int i = 0; i; grdLanguagedesc.Rows.Count; i++)
{

RadioButton rb = (RadioButton)grdLanguagedesc.Rows[i].FindControl(&quot;RowSelector&quot;);
if (rb.Checked == true)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), clientScript, return confirm(''Are you sure you want to delete this record?'');, true);
//ScriptManager.RegisterStartupScript(this, this.GetType(), clientScript, confirm_delete();, true);
//Page.ClientScript.RegisterStartupScript(this.GetType(), clientScript, javascript:if(!confirm(''Do you wish to complete this order?'')) return false;);
string msgid = grdLanguagedesc.Rows[i].Cells[1].Text;
DeleteRecords(msgid);
lblError.Visible = true;
return;
else
{
lblError.Visible = true;
lblError.Text = Please Select Record in GridView;
btnSearch.Focus();
lnkfilter.Focus();

}
}
}



<b>
How to show the confirm message before delete Grid view record when you click delete button outside the gridview?</b>

推荐答案


RadioButton rd = FindControl...

rd.attributes.add("onclick","return ShowAlert(this.id)");


4.编写如下的javascript函数ShowAlert()


4. Write a javascript function ShowAlert() as follows

function ShowAlert()
{
   var response = Confirm("Want to proceed?")
   if(response)
   return true;
    else
   return false;
}



希望对您有帮助.



Hope it helps you.


这篇关于单击gridview外部的删除按钮时,如何在删除grid视图记录之前显示确认消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 01:06