Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
WebSpellChecker fails within ASP.NET DataList EditItemTemplate?
posted

 

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&nbsp;Spelling" ID="lbtnSpellCheckY" 


         runat="server” 


         OnClientClick="SpellCheckY();return false;" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="btnUpdate" runat="server" 


         Text="Update" CommandName="update" />
&nbsp;&nbsp;&nbsp;&nbsp;
<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>


 


 


 


 


 


 

Parents
No Data
Reply
  • 37874
    posted

    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.

    WebSpellCheckerSample.zip
Children
No Data