如果我使用AutoPostBack=“”,对fireEvent()有任何影响吗;真“;在asp下拉列表中

Is there any impact on fireEvent(), if I use AutoPostBack="true" in asp dropdownlist?

本文关键字:任何 影响 下拉列表 asp AutoPostBack fireEvent 如果      更新时间:2023-09-26

我正在开发一个aspx页面。在页面中,我有三个下拉列表和一个按钮。所有这些下拉列表都将根据代码编写的代码隐藏文件(.cs文件)动态填充。为此,我需要使用两个事件处理程序方法来处理带有AutoPostBack="true"的前两个dropdownlist。然后,在单击Javascript文件中的按钮后,它应该fireEvent()具有一个由所选值组成的对象。但该页面并没有引发该事件。请帮我解决这个问题。PFB我的aspx页面代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupReference.aspx.cs"
Inherits="ButtonReference.Popups.PopupReference" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Reference Button Popup</title>  
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>
            Reference Button Popup</h1>
        <p>
            <asp:DropDownList ID="lookupcompDropdown" runat="server" AutoPostBack="true" onselectedindexchanged="lookupcomp_SelectedIndexChanged" >
            </asp:DropDownList>
            <asp:DropDownList ID="embeddedschemaDropdown" runat="server" AutoPostBack="true" onselectedindexchanged="embeddedschema_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:DropDownList ID="lookupvaluesDropdown" runat="server" AutoPostBack="false">
            </asp:DropDownList>
            <asp:Button ID="Submit" runat="server" Text="Submit" />
        </p>
    </div>
    </form>
</body>
</html>

Javascript文件:

Type.registerNamespace("RTFExtensions.Popups");
RTFExtensions.Popups.PopupReference = function (element) {
    Type.enableInterface(this, "RTFExtensions.Popups.PopupReference");
    this.addInterface("Tridion.Cme.View");
};
    RTFExtensions.Popups.PopupReference.prototype.initialize = function () {
        alert("initialized");    
        $log.message("Initializing Button Reference popup...");
        this.callBase("Tridion.Cme.View", "initialize");
        var p = this.properties;
        var c = p.controls;
        p.HtmlValue = { value: null };
        ($("#DropDownList1"), "System.Web.UI.WebControls.DropDownList");
            c.SubmitButon = $("#Submit");
    //asp dropdown
        c.DropDown = $("#lookupvaluesDropdown");
        $evt.addEventHandler(c.SubmitButon, "click", this.getDelegate(this._execute));
        $evt.addEventHandler(c.InsertButton, "click", this.getDelegate(this._execute));
    };
    RTFExtensions.Popups.PopupReference.prototype._execute = function () {
        alert("executing");
        //alert($("#lookupvaluesDropdown").value);
        this.properties.HtmlValue.value = $("#lookupvaluesDropdown").value;
        alert(this.properties.HtmlValue.value+"in execute");
        alert(this.fireEvent("submit1", this.properties.HtmlValue));
        //$("#Submit").fireEvent("submit1", this.properties.HtmlValue);
        window.close();
    };
    $display.registerView(RTFExtensions.Popups.PopupReference); 
请澄清您的问题。据我所知

您的按钮是asp按钮吗?如果是,请尝试使用OnClientClick事件调用javascript函数。访问javascript函数中的下拉列表以对其进行操作。

您的事件正在启动(尝试调试javascript),但在回发时会呈现一个全新的页面。尝试使用普通的HTML按钮而不是ASP按钮。