How to limit textbox template field text length in gridview?
<pre><code>            &lt;asp:GridView ID="CommentGrid" GridLines="None" runat="server" AutoGenerateColumns="False"&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField HeaderText="No." DataField="Num" &gt;
                    &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                &lt;/asp:BoundField&gt;
                &lt;asp:BoundField HeaderText="Subject Name" DataField="SubjectName"&gt;
                    &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                &lt;/asp:BoundField&gt;
                &lt;asp:TemplateField HeaderText="Comment"&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:TextBox ID="CommentBox" runat="server" TextMode="MultiLine" CssClass="commentTbx" MaxLength="2"&gt;&lt;/asp:TextBox&gt;
                    &lt;/ItemTemplate&gt;
                    &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                &lt;/asp:TemplateField&gt;
            &lt;/Columns&gt;
        &lt;/asp:GridView&gt;
</code></pre>

<blockquote>
  <p>The above Maxlength="2" doesnt work!! I even tried other method like databound, and foreach loop to code it but it still fails. </p>
</blockquote>
