I can successfully implement two WebSpellChecker controls on one page, each targeting a different textbox control.
However, as soon as I move one of the targeted textboxes into the EditItemTemplate of an ASP.NET DataList control, the associated WebSpellChecker control fails. That is, no dialog appears for the textbox in the EditItemTemplate.
Since the targeted textbox is in the EditItemTemplate, it may not be available (for binding) to the WebSpellChecker until the user clicks “Edit”.
Does anyone have any good idea why the WebSpellChecker fails (or, at least why my implementation fails) in this context? Any possible solutions?
User sees the following prior to clicking “Edit”…
After clicking “Edit”, user sees the following (the green area is the “Edit template”)…
Here’s a snippet of the code:
<asp:DataList ID="dlComments" …
<ItemTemplate>
…
</ItemTemplate>
<EditItemTemplate>
Comment:<asp:TextBox ID="txtCommentY" runat="server"… <br><asp:LinkButton Text="Check Spelling" ID="lbtnSpellCheckY"
runat="server”
OnClientClick="SpellCheckY();return false;" /> <asp:LinkButton ID="btnUpdate" runat="server"
Text="Update" CommandName="update" /> <asp:LinkButton ID="btnCancel" runat="server"
Text="Cancel" CommandName="cancel" />
</EditItemTemplate>
</asp:DataList>
<ig_spell:webspellchecker id="WebSpellCheckerY" runat="server"
TextComponentId="txtCommentY" ButtonId="btnSpellCheckY"> <DialogOptions ShowNoErrorsMessage="True" />
</ig_spell:webspellchecker>
<button id="btnSpellCheckY" type="button" runat="server" class="DisplayNone"/>
<script language="javascript" type="text/javascript">
function SpellCheckY() { $get("<%=btnSpellCheckY.ClientID%>").click(); }
</script>
Hi duuude,
It has been some time since your post but in case that you still need assistance I will be happy to help.
I suggest that you get the button element which calls the WebSpellChecker with getElementById function. It may also help to set the ClientIDMode of this button to static. I attached a sample, demonstrating the scenario you described.
If you have any other questions please feel free to contact me.