Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# asp:my usercontrol中的dropdownlist不会在SelectedIndexChanged上回发_C#_Asp.net_User Controls_Updatepanel_Postback - Fatal编程技术网

C# asp:my usercontrol中的dropdownlist不会在SelectedIndexChanged上回发

C# asp:my usercontrol中的dropdownlist不会在SelectedIndexChanged上回发,c#,asp.net,user-controls,updatepanel,postback,C#,Asp.net,User Controls,Updatepanel,Postback,我无法让usercontrol中的asp:下拉列表回发以更新天数 用户控件: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Profile.ascx.cs" Inherits="TestApp2.Views.Profile" %> <asp:UpdatePanel ID="ProfileMainUpdatePanel" runat="server"> <ContentTe

我无法让usercontrol中的asp:下拉列表回发以更新天数

用户控件:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Profile.ascx.cs" Inherits="TestApp2.Views.Profile" %>


<asp:UpdatePanel ID="ProfileMainUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="form-group profile-form">
                <asp:DropDownList runat="server" id="selYear" class="form-control profile-date right-align" OnSelectedIndexChanged="selYear_SelectedIndexChanged" />
                <asp:DropDownList runat="server" id="selMonth" class="form-control profile-date right-align" OnSelectedIndexChanged="selMonth_SelectedIndexChanged"  />
                <asp:DropDownList runat="server" id="selDay" class="form-control profile-date right-align"/>
                <asp:label runat="server" class="control-label right-align profile-form-label" for="selDay" Text="Date of Birth" ID="temp" />
            </div>
        </ContentTemplate>
</asp:UpdatePanel>
客户端代码为:

<script type="text/javascript">

function fillDays() {
    alert("yes");
}

函数fillDays(){
警惕(“是”);
}


那也不会开火

您需要设置
AutoPostBack=“true”
以获取SelectedIndexChanged事件,默认值为
false

<asp:DropDownList runat="server" id="selYear" AutoPostBack="true" class="form-control profile-date right-align" OnSelectedIndexChanged="selYear_SelectedIndexChanged"  />

在更新面板中尝试此操作。希望它能工作。。。

我可以发誓我已经试过了。。。啊,我还保留了attribute.add,一旦我删除了它,它就可以与自动回邮一起工作了。但在将它插入到我的real usercontrol中之后,它要么不起作用,要么出于某种原因还克隆了月份和年份数字。我已经检查过,page_load没有再次启动,因此调用是部分刷新,填充月份和日期的方法也没有在初始加载后重新启动(应该是这样的),但是每年和每月的DropDownList在每次调用selectionchanged事件时都会被克隆。
<script type="text/javascript">

function fillDays() {
    alert("yes");
}
<asp:DropDownList runat="server" id="selYear" AutoPostBack="true" class="form-control profile-date right-align" OnSelectedIndexChanged="selYear_SelectedIndexChanged"  />
 try this in Update Panel. Hope its working...


  <asp:UpdatePanel ID="ProfileMainUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
    <ContentTemplate>
        <div class="form-group profile-form">
            <asp:DropDownList runat="server" id="selYear" class="form-control profile-date right-align" OnSelectedIndexChanged="selYear_SelectedIndexChanged" />
            <asp:DropDownList runat="server" id="selMonth" class="form-control profile-date right-align" OnSelectedIndexChanged="selMonth_SelectedIndexChanged"  />
            <asp:DropDownList runat="server" id="selDay" class="form-control profile-date right-align"/>
            <asp:label runat="server" class="control-label right-align profile-form-label" for="selDay" Text="Date of Birth" ID="temp" />
        </div>
    </ContentTemplate>