zoukankan      html  css  js  c++  java
  • 触发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);

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

  • 相关阅读:
    html{-webkit-text-size-adjust:none;}(取消浏览器最小字体限制)
    移动端最小字体限制测试
    关键字(1)
    常用函数(1)
    新建体(2):create or replace object创建存储包、存储过程、函数
    关键字(5):cursor游标:(循环操作批量数据)
    关键字(6):trigger触发器
    新建体(1):新建type
    rownum查询前N条记录
    表连接join on
  • 原文地址:https://www.cnblogs.com/gdjlc/p/2086945.html
Copyright © 2011-2022 走看看