gpt4 book ai didi

javascript - 在自动回发下拉列表后刷新 javascript 代码

转载 作者:行者123 更新时间:2023-11-30 09:58:19 24 4
gpt4 key购买 nike

我有一个表格和一个公司下拉列表:

                          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%--DataSourceID="sdsEmpresaTarea"--%>
<asp:DropDownList ID="ddlEmpresaTarea" runat="server"
DataValueField="IdEmpresa" DataTextField="Empresa"
AutoPostBack="true" ViewStateMode="Enabled">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>

第二个下拉列表显示公司下拉列表中所选公司的联系人:

<asp:DropDownList ID="ddlContactoTarea" runat="server"
DataValueField="IdContacto" DataTextField="Nombre" ViewStateMode="Enabled">
</asp:DropDownList>

一个日期选择器文本框:

  <asp:TextBox ID="txtDate" runat="server" Text="" CssClass="datepicker" MaxLength="10" ViewStateMode="Enabled"/>
<asp:RequiredFieldValidator ID="rfvDate" runat="server"
ErrorMessage="Date required"
ControlToValidate="txtDate" Display="Dynamic">
</asp:RequiredFieldValidator>

The problem is when I expand the dropdownlist and I select an option,the dropdownlist execute the autopostback and in code I have a method to search the contacts for the company selected in the dropdownlist for companies, and then the datepicker doesn't work.I have to stress that when I charge the page, the datepicker works good, but then when I select a company in the dropdownlist, then datepicker doesn't work, and I think that this happened because the javascript code is not refresh after the autopostback.

How can I refresh the javascript code each time the dropdownlist for companies is selected?

最佳答案

Sys.Application.add_load 中发布您的 Javascript 代码

$(function(){
Sys.Application.add_load(function () {
// your Java script Code here
});

});

关于javascript - 在自动回发下拉列表后刷新 javascript 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32882613/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com