• checkbox 全选的使用


         1

    for(int i=0;i<this.dgWaitDraw.Items.Count;i++)
        {
        
         if((this.dgWaitDraw.Items[i].Cells[8].FindControl("cbDraw") as CheckBox).Checked)
         {
          partID=this.dgWaitDraw.Items[i].Cells[0].Text.Trim().ToString();
          getId=this.Request["getID"].ToString();
          iFactQty=int.Parse(this.dgWaitDraw.Items[i].Cells[4].Text.Trim().ToString());
          err=BLL.BLL.zh.ProjectOprate.updateDrawByPartIDAndDrawID(partID,getId,iFactQty,db);
          if(err!=0)
          {
           MessageBox.Show(this.Page,"领料失败!");
           tran.Rollback();
           return;
          }
         }
        }

     

    2

    <HeaderTemplate>
    <INPUT id=chkAll onclick="chk(this,'dgWaitDraw')" type=checkbox>全选
    </HeaderTemplate>

    <ItemTemplate>
    <asp:CheckBox id=cbDraw runat="server"></asp:CheckBox>
    </ItemTemplate>
    </asp:TemplateColumn>

    3      <script language="javascript">
       function printpage(myDiv)
       {
        //var strResult=window.confirm("确认用Word打印吗?");
        var strResult=true;
        if(strResult)
        {
         
         var newstr = document.all.item(myDiv).innerHTML;
         var oldstr = document.body.innerHTML;
         document.body.innerHTML = newstr;
         window.print();
         document.body.innerHTML = oldstr;
        }
       }
       
      
      function chk(chk,id)
      {
       var oEvent = document.all(id);
       var chks = oEvent.getElementsByTagName("INPUT");
       for(var i=0; i<chks.length; i++)
       {
        if(chks[i].type=="checkbox")
        chks[i].checked=chk.checked;
       }
      }
      </script>
              

  • 相关阅读:
    es6-compact-table 名词备忘
    JS 防抖和节流函数
    为什么 JS 对象内部属性遍历的顺序乱了
    JS 发送 HTTP 请求方法封装
    JS 一些位操作的妙用
    JS 格式化时间
    linux ssh连接
    c# checked 和 unchecked
    c# mvc action 跳转方式
    IIS 动态与静态压缩
  • 原文地址:https://www.cnblogs.com/csj007523/p/1250558.html
Copyright © 2020-2023  润新知