找到控件
Posted wonderfulviews
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了找到控件相关的知识,希望对你有一定的参考价值。
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++)
{
以上是关于找到控件的主要内容,如果未能解决你的问题,请参考以下文章
在方法中以编程方式移动控件警告“未找到方法”和“控件可能无法响应”