• 触发Repeater中的Dropdownlist的SelectedIndexChanged如何获得Repeater的当前行


     <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand">
      <ItemTemplate>
        <tr>
          <td>
              <asp:CheckBox ID="chkDel" runat="server" />
            </td>                                                             
            <td style="word-break: break-all" align="center">
                <asp:Literal runat="server" ID="ltlId" Text=' <%#Eval("Id")%>' Visible="false"> </asp:Literal>         
                <%# Eval("UserName")%>
            </td>         
            <td>
              <asp:DropDownList ID="ddlRole" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlRole_SelectedIndexChanged"> </asp:DropDownList>                    </td>                       
                           

    --------------------------------------------------------------


    protected void ddlRole_SelectedIndexChanged(object sender, EventArgs e)
        {
          // Response.Write(((DropDownList)sender).SelectedValue);

            DropDownList ddlRole = (DropDownList)sender;
            int roleId = Convert.ToInt32(ddlRole.SelectedValue);

            Repeater rptUserList = ddlRole.Parent.Parent as Repeater;
            int n = ((RepeaterItem)ddlRole.Parent).ItemIndex;       
            int Id = Convert.ToInt32(((Literal)(rptUserList.Items[n].FindControl("ltlId"))).Text);

         
            //....下面写进数据库操作
          //....
           
        }

  • 相关阅读:
    vue通过input选取图片,jq的ajax向服务器上传img
    IDEA常用快捷键
    JavaScript预解析
    jQuery实现颜色打字机
    MVC超链接调用控制器内的方法
    jQuery实现鼠标移入切换图片
    聚类算法
    并行K-Means
    [Err] 1055
    地图匹配实践
  • 原文地址:https://www.cnblogs.com/gdjlc/p/2086945.html
Copyright © 2020-2023  润新知