Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在“从按钮操作提交”按钮上显示修改的“确认”_C#_Asp.net_Ajaxcontroltoolkit - Fatal编程技术网

C# 在“从按钮操作提交”按钮上显示修改的“确认”

C# 在“从按钮操作提交”按钮上显示修改的“确认”,c#,asp.net,ajaxcontroltoolkit,C#,Asp.net,Ajaxcontroltoolkit,您好,我使用的是ajax确认按钮,就像这样,当单击按钮而不是看到ConfirmText=时,您确定要单击此按钮吗?我想让它显示我从代码背后传递的文本 <ajaxToolkit:ConfirmButtonExtender ID="cbe" runat="server" TargetControlID="Cancel" ConfirmText="Are you sure you want to click this?" /> 然后我

您好,我使用的是ajax确认按钮,就像这样,当单击按钮而不是看到ConfirmText=时,您确定要单击此按钮吗?我想让它显示我从代码背后传递的文本

    <ajaxToolkit:ConfirmButtonExtender ID="cbe" runat="server"
   TargetControlID="Cancel"
           ConfirmText="Are you sure you want to click this?"
         />
然后我的按钮动作

protected void Cancel_Click(object sender, ImageClickEventArgs e)
        {   display();
            anothermethod();
            Response.Redirect("home.aspx");
        }

当我点击“取消”按钮时,没有看到我在“确认”上的错误。我明白了,你确定要单击此按钮吗?这是默认值。是否有任何方法可以在单击按钮或按钮返回时更新ConfirmButtonExtender。或任何其他解决方案,谢谢

我不明白为什么要更改按钮本身触发的服务器端事件上的客户端确认对话文本

此外,如果要以编程方式设置错误消息,可以在按下“取消”按钮之前进行设置:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string error = "my error";
        cbe.ConfirmText = error;
    }
}
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string error = "my error";
        cbe.ConfirmText = error;
    }
}