首页 > 代码库 > 找到控件

找到控件

   protected void method_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                CustDropDownList ddlbaoxian = (CustDropDownList)sender;//通过sender找到
                int iCount = (ddlbaoxian.NamingContainer as ListViewDataItem).DataItemIndex;

                ListViewDataItem lvdi = lv5.Items[iCount]; //CustListView的ID
                string strPayItem = ddlbaoxian.SelectedItem.Value;
                CustDropDownList ddlbaoxians = (CustDropDownList)lvdi.FindControl("ddlbaoxian");
                CustLabel lblProp_MainInsKind = (CustLabel)lvdi.FindControl("lblProp_MainInsKind");
                ddlbaoxians.SelectByValue(strPayItem);
                String strlblProp_MainInsKind = lblProp_MainInsKind.Text.Trim();
            }
            catch (Exception ex)
            {
                SaveLog(ex);
                UnLock();
            }
        }

 

 

     //先找到CustListView
            for (int i = 0; i < lv3.Items.Count; i++)
            {
                ListViewDataItem ItemDetail = lv3.Items[i];
                CustListView lv1Rider = (CustListView)ItemDetail.FindControl("lv1Rider");
                if (lv1Rider != null)
                {
                    for (int j = 0; j < lv1Rider.Items.Count; j++)
                    {

找到控件