I am currently working on an aspx page. This page includes three dropdown lists and a button, all of which are populated dynamically based on the code written in the code-behind file (.cs file). To achieve this, I need to utilize two event handler methods for the first two dropdown lists with AutoPostBack="true"
. After clicking the button, the Javascript file should trigger fireEvent()
, passing an object that contains the selected value. However, I am encountering an issue where the page is not firing the event. I would appreciate any help in resolving this problem. Below is the code for my aspx page:
<%@ 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 file:
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);