开发者

CheckBox inside ListView control using ASP.Net 3.5

开发者 https://www.devze.com 2023-01-26 02:02 出处:网络
When CheckBox is unchecked in a ListView i need 开发者_运维知识库to get a popup window?I have make a JS function and just pass id of your list like as

When CheckBox is unchecked in a ListView i need 开发者_运维知识库to get a popup window?


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


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


$('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?

0

精彩评论

暂无评论...
验证码 换一张
取 消