在aspx页面获取自定义控件ascx中的控件值
<%@Register TagPrefix="UsrControl" TagName="TenantFinder" Src="../UsrControl/TenderFinder.ascx"%>" 在Content中 <UsrControl:TenderFinder ID ="tenantFinder" runat="server" /> 调用: BSCheckBoxList chkLstContractStatus = (BSCheckBoxList)tenderFinder.FindContrl("chkLstContractStatus"); ArrayList lists = new ArrayList(); foreach(ListItem item in chkLstContractStatus.Items) { if(item.Selected) { lists.Add(item.Value); } } string status = string.empty; foreach(string str in lists) { status += str + ","; } if(status.Length > 0) { status = status.Substring(0,status.Length - 1); }
BSCheckBoxList chk = (BSCheckBoxList)tenderFinder.FindControl("chkContractStatus");