如果我使用AutoPostBack=“”,对fireEvent()有任何影响吗;真“;在asp下拉列表中
Is there any impact on fireEvent(), if I use AutoPostBack="true" in asp dropdownlist?
我正在开发一个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按钮。
相关文章:
- 在同一个服务工作者中处理service-worker.js有任何影响吗
- 是否有任何CSS属性对其元素没有影响
- ReactCSSTransitionGroup不产生任何影响
- 删除HTML脚本标记会对它所包含的JavaScript产生任何影响吗
- jQuery.text() - 如何在不影响任何子元素的情况下更改标签的文本
- requestAnimationFrame的目的是什么?它对重绘时间没有任何影响
- 为什么后递增/递减运算符对循环中的变量没有任何影响
- 如果我使用AutoPostBack=“”,对fireEvent()有任何影响吗;真“;在asp下拉列表中
- Javascript-命名空间嵌套是否存在任何硬性限制(或性能影响)
- Babel对我的Javascript没有任何影响
- 当我们悬停任何东西时会影响其他元素
- 反转字符串而不影响任何特殊字符
- 在html标签中使用合成属性是否有任何可能的负面影响?
- 具有相同名称的嵌套settimeout,这样做会产生任何影响
- 做“setInterval"对浏览器行为有任何影响
- 将$scope函数转换为常规var函数.对性能有任何影响吗
- 在JavaScript中使用多个分号有任何影响吗?
- 如何在不影响php中任何其他函数的情况下清除先前返回的结果?
- 我做的路点工作很顺利,但改变速度值并没有影响任何原因
- 如果同时调用$doChanges,$doCheck如何不会产生任何影响