Pregunta

I have one page with 3 FreeTextBox controls on it. They are set up correctly, and I was using them normally until I needed to add a DropDownList control that would PostBack to the server, but I was surprised to see that the OnSelectedIndexChanged event would never trigger. If I was to do a Post with a button, or some other server-side control, then would the event be triggered. After much debugging I found the following Javascript error was being thrown every time I selected something different on my DropDownList control:

TypeError: FTB_API.MainContent_MainContent_FreeTextBox1 is undefined

The error seems pretty straight forward; Firebug tells me this error comes from the following function:

function WebForm_OnSubmit()
{
    FTB_API['MainContent_MainContent_FreeTextBox1'].StoreHtml();FTB_API['MainContent_MainContent_FreeTextBox2'].StoreHtml();FTB_API['MainContent_MainContent_FreeTextBox3'].StoreHtml();
    return true;
} 

I've tried several things without success. When I remove the FreeTextBox controls from my page, I have successful PostBacks. Any help would be appreciated. Thanks.

EDIT 1: This is some of my markup

3 FreeTextBox set up like this:

<FTB:FreeTextBox ID="FreeTextBox3" JavaScriptLocation="ExternalFile" ButtonImagesLocation="ExternalFile" ToolbarImagesLocation="ExternalFile" runat="server" EnableHtmlMode="true" />

My DropDownList:

<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
¿Fue útil?

Solución 2

I have found the answer to the question in this thread: Hidden FreeTextBox bug on Firefox It seems for some reason that when the control is not visible or is hidden (I have tabs) it behaves this way. The answer is kind of a Hack, but it works. Thanks for the answers.

Otros consejos

Set the property AutoPostBack = true of your dropdown in markup page. This will make the post back when you change the dropdown element and OnSelectedIndexChanged get triggered.

Example :

<asp:DropDownList id="drpList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="event name" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top