zoukankan      html  css  js  c++  java
  • Repeater中通过CommandName 获取到CommandArgument='<%#Eval("id") %>' 的值

    前台:

    <asp:Repeater ID="RepeaterShow" runat="server" OnItemCommand="RepeaterShow_ItemCommand">
    <%--OnItemCommand="Repeater1_ItemCommand"--%>
    <ItemTemplate>

    <tr role="row" class="gradeX even">

    <%-- <td>
    <asp:Label ID="Label2" runat="server" Text='<%# Eval("id") %>'></asp:Label></td>--%>
    <td>
    <asp:Label ID="Label1" Text='<%# Eval("title") %>' runat="server"></asp:Label></td>

    <td>
    <%-- <a class="make" onmouseup="hide('open')" href="#" onclick="SelectedImg(<%#Eval("id")%>)">
    选中</a>--%>
    <asp:LinkButton ID="LinkButton1" CommandName="make" CommandArgument='<%#Eval("id") %>' runat="server">选中</asp:LinkButton><%--OnClientClick="SelectedImg(<%#Eval("id")%>)"--%>

    </td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>

     

     

    后台:

    protected void Page_Load(object sender, EventArgs e)
    {
    BindDate();
    }
    public void BindDate()//绑定数据
    {
    RepeaterShow.DataSource = IBLL.Factory.infoArticleCreate().GetModelList("Id=21");
    RepeaterShow.DataBind();
    }
    protected void RepeaterShow_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
    if (e.CommandName == "make")
    {
       string str = e.CommandArgument.ToString();
       this.Alert(str);
    }

    }

     

  • 相关阅读:
    40. 组合总和 II(回溯法)
    39. 组合总和(回溯法)
    1640. 能否连接形成数组
    890. 查找和替换模式
    386. 字典序排数
    20. 有效的括号
    496. 下一个更大元素 I
    115. 不同的子序列
    59. 螺旋矩阵 II
    HTML基本结构,标签
  • 原文地址:https://www.cnblogs.com/shanshuiYiCheng/p/9626383.html
Copyright © 2011-2022 走看看