【问题标题】:JavaScript onchange event is not firing in IIS7JavaScript onchange 事件未在 IIS7 中触发
【发布时间】:2016-05-13 06:20:05
【问题描述】:

源代码:

<ajaxToolkit:TabContainer ID="tbMBQOutputs" runat="server" Width="100%" Height="720px">
    <ajaxToolkit:TabPanel ID="tbDashboard" runat="server" Height="100%" ToolTip="Dashboard">
    <HeaderTemplate>Dashboard</HeaderTemplate>
    <ContentTemplate>
        <asp:UpdatePanel ID="upDashboard" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
           <table bgcolor="#E6E6FA" align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
           <tr>
               <td>
                    <asp:Panel ID="pnlDashboard_DC" runat="server" GroupingText="Dashboard">
                    <table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
                    <tr>
                        <td align="center">
                             <asp:Label ID="lblReportCycle_DB" runat="server" Text="Report Cycle"></asp:Label>&emsp;   
                             <asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" ></asp:DropDownList>
                          </td>
                     </tr>                         
                     <tr>
                          <td align="center">
                               <asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
                          </td>
                      </tr>
                 </table>
                 </asp:Panel>
            </td>
            </tr>
            </table>
            </ContentTemplate>
       </asp:UpdatePanel>
       </ContentTemplate>
       </ajaxToolkit:TabPanel>
   </ajaxToolkit:TabContainer>

JavaScript:

  <script type="text/javascript">
         function ProgressImage_DashBoard() {
        $('#<%=lblMsgDashBoard_DB.ClientID%>').html("Processing.... Please wait...!!!");
    }
  </script>

文件背后的代码:

  protected void Page_Load(object sender, EventArgs e)
  {
       ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");
  }

此编码在我的系统中运行良好。但是当我在 IIS 7 中发布代码时,下拉列表更改事件根本没有触发。

但是当我在页面加载事件中注释以下代码时,

//ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");

在 IIS 7 中,下拉列表更改事件有效。我需要在下拉列表更改事件期间显示标签消息。即处理。为什么此代码在 IIS 7 中不起作用?

【问题讨论】:

    标签: javascript c# asp.net iis-7 onchange


    【解决方案1】:

    这显然是由 JavaScript 的 IE 配置引起的。在 IIE7 中,出于某种安全原因,默认配置是“禁用 JavaScript”,因此您必须启用它。

    https://forums.iis.net/t/1150606.aspx

    【讨论】:

      【解决方案2】:

      我试过了,它工作正常..

      源代码:

        <asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
        <asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" onchange="ShowMsg(this);"></asp:DropDownList>
      

      JavaScript:

        function ShowMsg(ddl) {            
              var lblMsg = document.getElementById("<%=lblMsgDashBoard_DB.ClientID %>");
              $(lblMsg).html("Processing.... Please wait...!!!");
          }
      

      【讨论】:

        猜你喜欢
        • 2017-11-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多