通过code-落后于C#得到确认框值 [英] Get confirm-box value via code-behind at C#

查看:112
本文介绍了通过code-落后于C#得到确认框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从身边的值来确认ASPX

I want to get the value from side to confirm aspx

bool type=false;

 type=   ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "confirm('are you confirm?')", true);

if(type){
...
}

我如何获得的价值?

How do I get the value of?

推荐答案

不听起来像是最好的办法(我的意思是,你可以显示弹出客户端)的......但是,如果你想做到这一点。 ..

Doesn't sound like best of the approach (I mean you could show pop-up client side)... However, if you want to accomplish this...

您已经有一个隐藏的asp:按钮在你的aspx并附加一个事件处理程序,并写出你想在点击是确认按钮已经执行了code

You have have a hidden asp:Button on your aspx and attach a event handler to it and write the code that you want to have executed upon clicking Yes on the confirm button.

和修改的RegisterStartupScript如下

And modify your RegisterStartupScript as below

type=   ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "if(confirm('are you confirm?')) { document.getElementById('btn').click(); } ", true);

这篇关于通过code-落后于C#得到确认框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆