使用 ASP.Net 3.5 的 ListView 控件内的复选框

发布于 2024-10-03 07:03:29 字数 44 浏览 0 评论 0原文

当 ListView 中的 CheckBox 未选中时,我需要弹出窗口吗?

When CheckBox is unchecked in a ListView i need to get a popup window?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

疾风者 2024-10-10 07:03:29

我创建了一个 JS 函数,然后传递你的列表的 id,就像

OnClientClick="return GetSelectedCheckBoxInGrid('grdCustomer');"

function GetSelectedCheckBoxInGrid(obj)
{              
      var con = 'ctl00_ContentPlaceHolder1_' + obj
      var Parent =  document.getElementById(con);
      var TargetChildControl = "chk";

      if (Parent==null)
      {
          return false;      
      }

      var items = Parent.getElementsByTagName("input"); 

      for(var n = 0; n < items.length; ++n)
         if(items[n].type == 'checkbox' && 
            items[n].id.indexOf(TargetChildControl,0) >= 0 && 
            items[n].checked == false)
           alert('Hi');return false;)

}

我认为的那样

I have make a JS function and just pass id of your list like as

OnClientClick="return GetSelectedCheckBoxInGrid('grdCustomer');"

function GetSelectedCheckBoxInGrid(obj)
{              
      var con = 'ctl00_ContentPlaceHolder1_' + obj
      var Parent =  document.getElementById(con);
      var TargetChildControl = "chk";

      if (Parent==null)
      {
          return false;      
      }

      var items = Parent.getElementsByTagName("input"); 

      for(var n = 0; n < items.length; ++n)
         if(items[n].type == 'checkbox' && 
            items[n].id.indexOf(TargetChildControl,0) >= 0 && 
            items[n].checked == false)
           alert('Hi');return false;)

}

I think this is that

去了角落 2024-10-10 07:03:29

对此不太确定,但假设,您可以为每个复选框指定一个类,例如 chkbox,然后使用一些 jquery 代码来处理单击事件:

$('chkbox').click(function() {
Alert("这是您放置弹出代码的位置");
});

你可以在这里使用 window.open

Not too sure about this, but hypothetically, you could give each checkbox a class, eg chkbox, and then have some jquery code to handle a click event:

$('chkbox').click(function() {
alert("here is where you put your popup code");
});

You could use window.open here

意中人 2024-10-10 07:03:29
$('chkbox').click(function() {
  if (! $('#chkbox').is(':checked')) 
  {
    window.open ("http://www.javascript-coder.com","mywindow","status=1");
  } 
});

$('chkbox').click(function() {
  if(! $('#chkbox').attr('checked')) 
  {
    window.open ("http://www.javascript-coder.com","mywindow","status=1");
  } 
});

如何在 jQuery 中检查复选框是否被选中?

$('chkbox').click(function() {
  if (! $('#chkbox').is(':checked')) 
  {
    window.open ("http://www.javascript-coder.com","mywindow","status=1");
  } 
});

or

$('chkbox').click(function() {
  if(! $('#chkbox').attr('checked')) 
  {
    window.open ("http://www.javascript-coder.com","mywindow","status=1");
  } 
});

How to check whether a checkbox is checked in jQuery?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文