簡體   English   中英

如果我在asp dropdownlist中使用AutoPostBack =“ true”,對fireEvent()有什么影響?

[英]Is there any impact on fireEvent(), if I use AutoPostBack=“true” in asp dropdownlist?

我正在開發一個aspx頁面。 在頁面中,我有三個下拉列表和一個按鈕。 所有這些下拉列表都將根據文件(.cs文件)后面的代碼動態填充。 為此,我需要對前兩個具有AutoPostBack="true"下拉列表使用兩個事件處理程序方法。 然后,在單擊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); 

請澄清您的問題。 據我了解

您的Button是asp按鈕嗎?如果是,請嘗試使用OnClientClick事件來調用javascript函數。 訪問您的javascript函數中的下拉列表以對其進行操作。

您的事件正在觸發(嘗試調試JavaScript),但在回發時將呈現一個全新的頁面。 嘗試使用普通的HTML按鈕而不是ASP按鈕。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM