我创建了一个基本的用户控件,其中有三个下拉列表(年,月,日),用于公开属性 我希望从我的代码隐藏页面进行设置。这很好用
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="DateControl.ascx.vb" ClassName="DateControl"
Inherits="DateControl" %>
<%--<asp:ScriptManager ID="dd" runat="server">
</asp:ScriptManager>--%>
<div class="form-inline">
<div class="form-group">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddlDay" OnSelectedIndexChanged="DDLActual_OnChange" runat="server" CssClass="form-control" />
<asp:DropDownList ID="ddlMonth" OnSelectedIndexChanged="DDLActual_OnChange" runat="server" CssClass="form-control" />
<asp:DropDownList ID="ddlYear" OnSelectedIndexChanged="DDLActual_OnChange" runat="server" CssClass="form-control" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
当我将此usercontorl放入转发器并尝试通过创建来修改每个项目的代码隐藏时,问题就开始了 方法
<uc3:DateControl ID="txtDate" runat="server" Visible="false" OnChange="txtDate_PostBack" />
Protected Sub txtDate_PostBack(ByVal sender As Object, ByVal e As System.EventArgs)
Dim btndetails As DateControl = TryCast(sender, DateControl)
Dim ltrIsFormulaApplied As Literal = DirectCast(btndetails.FindControl("ltrIsFormulaApplied"), Literal)
End If
btndetails显示什么,我无法访问其他控件的值,任何帮助都会非常感激..