zoukankan      html  css  js  c++  java
  • CommandArgument 传递多个参数(以2个为例)

     <asp:GridView ID="GVSecondType" runat="server" AutoGenerateColumns="False" Style="position: relative" Width="100%" CellPadding="4" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" AllowPaging="True" OnPageIndexChanging="GVSecondType_PageIndexChanging" OnRowCommand="GVSecondType_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="所属一级分类">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblName" runat="server" Style="position: relative" Text='<%#Eval("Parent_TypeName1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Id" HeaderText="分类ID" />
                <asp:BoundField DataField="Type_Name" HeaderText="分类名" />
                 <asp:BoundField DataField="Parent_Id" HeaderText="所属父类" />
                <asp:BoundField DataField="Type_AddTime" HeaderText="添加时间" />
                <asp:TemplateField HeaderText="编 辑">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                       <div style="70px;line-height:20px; cursor:pointer;background-color:#CCCCCC; border:solid 1px #000000; "><a  style="text-decoration:none; cursor:pointer" href='ModifySecondType.aspx?TypeId=<%#Eval("Id") %>'>修改</a></div>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="删 除">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <div onmouseover="javascript:this.style.cursor='hand'" style="70px; line-height:20px;background-color:#CCCCCC;border:solid 1px #000000;"> <asp:LinkButton ID="LinkButton1" CommandName="del" CommandArgument='<%# Eval("Parent_Id")+","+Eval("Id")  %>'  runat="server">删除</asp:LinkButton></div>
                    </ItemTemplate>
                </asp:TemplateField>
               
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        </asp:GridView> 
    
    protected void GVSecondType_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string cmdName = e.CommandName;
            if (cmdName == "del")
            {
                string[] estr = e.CommandArgument.ToString().Split(',');
    
                int Parent_Id = Convert.ToInt32(estr[0]);
                int TypeId = Convert.ToInt32(estr[1]);
                bool flag = YHTBLL.Second_TypeManage.DelTypeById(Parent_Id, TypeId);
                if (flag)
                {
                    this.Literal1.Text = "删 除 成 功";
                    bind();
                }
    
                else
                {
                    this.Literal1.Text = "删 除失 败";
                    bind();
                }
    
            }
         
        }
    
    
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/y_h_t/archive/2009/11/18/4827980.aspx
    

  • 相关阅读:
    oracle中的事务
    delect 删除
    update更新修改数据
    insert插入数据
    复制表、复制表结构、复制数据
    子查询
    分组函数
    C++实现红外Fir谱图文件转BMP图片文件
    windows下安装mysql-5.7.20-winx64
    数据库设计——数值类型
  • 原文地址:https://www.cnblogs.com/jayleke/p/1813987.html
Copyright © 2011-2022 走看看