![](/img/trans.png)
[英]DropDownList not firing onbeforeunload when AutoPostBack=“True”
[英]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.