Data Binding with ASPNetSpell

ASPNetSpell supports Microsoft's Data controls - including repeaters and grids and formviews.


DataBinding SpellButtons

The SpellButton will automatically detect that it is in a repeater or grid - and look in its own row for a control of the name in FieldsToSpellcheck

The following code will work

SourceCode:
<asp:Repeater ID="Repeater1" runat="server">
      <ItemTemplate>
          <asp:TextBox ID="TextBox1" runat="server"  TextMode="MultiLine" Text='<%# Bind("MyText") %>' ></asp:TextBox>
          <ASPNetSpell:SpellButton ID="SpellButton1" runat="server" FieldsToSpellCheck="TextBox1" />
      </ItemTemplate>
</asp:Repeater>


Alternatively - you can bind manually to the TextBox's ClientId:

SourceCode:
<asp:Repeater ID="Repeater2" runat="server">
      <ItemTemplate>
          <asp:TextBox ID="TextBox1" runat="server"  TextMode="MultiLine" Text='<%# Bind("MyText") %>' ></asp:TextBox>
      <ASPNetSpell:SpellButton FieldsToSpellCheck='<%# Container.FindControl("TextBox1").ClientId %>' ID="SpellButton1" runat="server"  />
      </ItemTemplate>
</asp:Repeater>



DataBinding SpellTextAreas

To keep things simple - each SpellTextBox inherits all of the DataBinding behavior of a regular TextBox

SourceCode:
<ASPNetSpell:SpellTextBox ID="DescriptionTextBox" runat="server"  Text='<%# Bind("Description") %>' />

This can be used in the EditItemTemplate of a FormView for example