zoukankan      html  css  js  c++  java
  • GridView的一些操作

    GridView删除行

    1. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting">  
    2.     <Columns>   
    3.         <asp:BoundField DataField="id" HeaderText="id" />  
    4.         <asp:BoundField DataField="name" HeaderText="name" />  
    5.         <asp:TemplateField ShowHeader="False">  
    6.             <ItemTemplate>  
    7.                 <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"  
    8.                     Text="删除" OnClientClick='<%#  "if (!confirm(\"你确定要删除" + Eval("name").ToString() + "吗?\")) return false;"%>'></asp:LinkButton>  
    9.             </ItemTemplate>  
    10.         </asp:TemplateField>  
    11.     </Columns>  
    12.  </asp:GridView>  

    批量删除

    前台

     <asp:TemplateField ItemStyle-Width="8%">
    	<HeaderStyle Wrap="False"></HeaderStyle>
    				            <ItemStyle></ItemStyle>
    				            <HeaderTemplate>
     <asp:CheckBox id="Hk_SelectAll" onclick="javascript:CheckAllGridCheckBox(this,'Hk_Select');"
    	 runat="server" Text="全选"></asp:CheckBox>
    				            </HeaderTemplate>
    				            <ItemTemplate>
    				                  <span name="sel" selname="sel">
    					            <asp:CheckBox id="Hk_Select" onclick="javascript:CheckOneGridItem('Hk_SelectAll','gv_recommendHouse','Hk_Select');"
    						            runat="server" Visible="true"></asp:CheckBox></span>
    				            </ItemTemplate>
    				          </asp:TemplateField>
    


    protected void btn_Agent_delete_Click(object sender, EventArgs e)
            {
                string ids = "", members = "";
    
                for (int i = 0; i < gv_recommendAgent.Rows.Count; i++)
                {
                    if (((CheckBox)gv_recommendAgent.Rows[i].Cells[0].FindControl("Ak_Select")).Checked == true)
                    {
                        ids += gv_recommendAgent.DataKeys[i].Value + ",";
                        members += gv_recommendAgent.DataKeys[i].Value + ",";
                    }
                }
    
                Loan.Function.boc.RecommendData.DelRecommend(GetInterger(user.BankId.ToString(), 1), listType.ToString(), ids);
                Response.Redirect("/Manager/boc/recommendlist.aspx?list=2");
            }
    

  • 相关阅读:
    QWrap简介之:EventW Event包装
    QWrap简介之:core_retouch 渲染原生类
    QWrap简介之:youa_retouch 项目个性
    QWrap简介之:Apps 应用 收获果实
    QWrap简介之:Wrap模式
    QWrap简介之:dom_retouch NodeW 勇士装甲
    Activity之间的数据传递
    OpenGL ES Tutorial for Android
    从零开始学习OpenGL ES之一 – 基本概念
    java自定义注解
  • 原文地址:https://www.cnblogs.com/zhangji/p/1863265.html
Copyright © 2011-2022 走看看