Completly stumped here, Im creating a widget in ektron that was working fine 2 days ago and all the sudden all events stopped working for no reason. Ive been trying to track down the culprit to no avail.
My aspx file is a basic multiview with two views, one for edit settings and the other for content.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContentPlus.ascx.cs" Inherits="widget_ContentPlus" Debug="true" %>
<asp:multiview ID="contentPlusWidget" runat="server">
<asp:View ID="vEdit" runat="server">
<table>
<tr>
<td class="label">Content: </td>
<td><asp:DropDownList ID="ddlContentType" runat="server" class='displayType'></asp:DropDownList></td>
</tr>
<tr>
<td><asp:Button ID="btnSave" runat="server" Text="Save" /></td>
<td><asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td>
</tr>
</table>
</asp:View>
<asp:View ID="vContent" runat="server">
<!-- Content Code -->
</asp:View>
</asp:multiview>
Then in the contentplus.ascx.cs file I have my page events and then my btn events
protected void Page_Init() {
_host = Ektron.Cms.Widget.WidgetHost.GetHost(this);
_host.Title = "My Widget";
_host.Edit += new EditDelegate(EditEvent);
_host.ExpandOptions = Expandable.ExpandOnEdit;
btnSave.Click += new EventHandler(btnSave_Click);
btnCancel.Click += new EventHandler(btnCancel_Click);
}
protected void Page_Load() {
if(!this.IsPostBack)
ChangeViewTo(vContent);
}
protected void btnSave_Click(object sender, EventArgs e) {
Javascript.Alert("SAVED!");
SaveSelectedIndex();
ChangeViewTo(vContent);
}
protected void btnCancel_Click(object sender, EventArgs e) {
Javascript.Alert("CANCEL!");
ChangeViewTo(vContent);
}
public void EditEvent(string settings) {
Javascript.Alert("EDIT!");
ChangeViewTo(vEdit);
PopulateDropDownBoxWithAvailableContent();
}
void ChangeViewTo(View view) {
Javascript.ConsoleLog(view.ID);
contentPlusWidget.SetActiveView(view);
if(view.Equals(vEdit))
PopulateDropDownBoxWithAvailableContent();
}
Several things are not working, first when the settings button is clicked, the screen turns grey with the spinning icon and when it comes back nothing has happened. This usually happens when the _host.Edit += new EditDelegate(EditEvent);
delegate has not been set, but as you see it has been. Second, When I set the settings view to default, and I press the save or cancel buttons, you get the spinning dialog and then nothing. The event code is never triggered. But you can see that I assigned the event delegate in Page_Init()
I feel like Im missing something obvious but Ive been stumped for a day. Any ideas?
Edit: changed title to reflect current understanding of the issue
OK found the solution and ill post it for anyone else.
When Ektron does a ajax postback it expects the response to be in the format
1|#||4|6696|updatePanel|ctl00_cphBillBoard_dzLeft_updatepanel|
<div id="ctl00_cphBillBoard_dzLeft_dzcontainer" class="dropzone PBClear" EditMode="true">....<the rest of your content>.....
Those pipes in the beginning are very important, in several places in my code I was dynamically injecting javascript for debugging inside the browser purposes, I was also logging some error messages to the screen using Response.Write(); these got injected before my pipes so it messed up the ajax request. When I realized this and removed all my logging, everything worked!