【问题标题】:CheckBox inside ListView control using ASP.Net 3.5使用 ASP.Net 3.5 的 ListView 控件内的 CheckBox
【发布时间】:2010-11-19 08:10:56
【问题描述】:

当在 ListView 中取消选中 CheckBox 时,我需要弹出一个窗口吗?

【问题讨论】:

    标签: c# .net asp.net .net-3.5 asp.net-2.0


    【解决方案1】:

    我已经创建了一个 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;)
    
    }
    

    我觉得是这样的

    【讨论】:

      【解决方案2】:

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

      $('chkbox').click(function() { alert("这里是你放弹出代码的地方"); });

      你可以在这里使用 window.open

      【讨论】:

        【解决方案3】:
        $('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");
          } 
        });
        

        How to check whether a checkbox is checked in jQuery?

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-10-18
          • 1970-01-01
          • 2011-03-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多