客户确认后DROPDOWNLIST autoposback [英] DropdownList autoposback after client confirmation

查看:395
本文介绍了客户确认后DROPDOWNLIST autoposback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有设置为true的自动回一个DropDownList。我想要的
用户确认,如果他们真的想改变的价值,
这对后回触发一个服务器端事件(的SelectedIndexChanged)。

I have a dropdownlist with the autopostback set to true. I want the user to confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged).

我曾尝试添加onchange属性返回确认(请单击确定以更改,否则单击取消。?;),但它不会不管回发确认的
结果,如果取消列表中的值不恢复
选中。

I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it will not postback regardless of the confirm result and the value in the list does not revert back if cancel selected.

当我从DROPDOWNLIST标签移除onchange属性,页面不回发。它不添加onchange属性时。我还需要接线的事件处理程序(我在C#.NET 2.0)。

When I remove the onchange attribute from the DropdownList tag, the page does postback. It does not when the onchange attribute is added. Do I still need to wire the event handler (I'm on C# .Net 2.0 ).

任何线索会有所帮助。

谢谢!

推荐答案

您是否尝试过onChange事件设置为一个JavaScript函数,然后在函数中显示JavaScript警告,如果它通过利用__doPostBack功能?

Have you tried to set the onChange event to a javascript function and then inside the function display the javascript alert and utilize the __doPostback function if it passes?

   
drpControl.Attributes("onChange") = "DisplayConfirmation();"

function DisplayConfirmation() {
  if (confirm('Are you sure you want to do this?')) {
    __doPostback('drpControl','');
  }
}

这篇关于客户确认后DROPDOWNLIST autoposback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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