ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Add RequiredField Validator to dynamic TextBoxes in ASP.Net GridView Rows using C# and VB.Net<p>Hi&nbsp;<a class="username" rel="sathish75">sathish75,</a></p> <p>Change the html with the below.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;asp:GridView ID=&#34;Gridview1&#34; runat=&#34;server&#34; ShowFooter=&#34;true&#34; AutoGenerateColumns=&#34;false&#34; OnRowCreated=&#34;Gridview1_RowCreated&#34;&gt; &lt;Columns&gt; &lt;asp:BoundField DataField=&#34;RowNumber&#34; HeaderText=&#34;Row Number&#34; /&gt; &lt;asp:TemplateField HeaderText=&#34;Header 1&#34;&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID=&#34;TextBox1&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ControlToValidate=&#34;TextBox1&#34; ErrorMessage=&#34;Required&#34; runat=&#34;server&#34; Display=&#34;Dynamic&#34; ValidationGroup=&#34;G1&#34; ForeColor=&#34;Red&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText=&#34;Header 2&#34;&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID=&#34;TextBox2&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ControlToValidate=&#34;TextBox2&#34; ErrorMessage=&#34;Required&#34; runat=&#34;server&#34; Display=&#34;Dynamic&#34; ValidationGroup=&#34;G1&#34; ForeColor=&#34;Red&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText=&#34;Header 3&#34;&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID=&#34;TextBox3&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ControlToValidate=&#34;TextBox3&#34; ErrorMessage=&#34;Required&#34; runat=&#34;server&#34; Display=&#34;Dynamic&#34; ValidationGroup=&#34;G1&#34; ForeColor=&#34;Red&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/ItemTemplate&gt; &lt;FooterStyle HorizontalAlign=&#34;Right&#34; /&gt; &lt;FooterTemplate&gt; &lt;asp:Button ID=&#34;ButtonAdd&#34; runat=&#34;server&#34; Text=&#34;Add New Row&#34; OnClick=&#34;ButtonAdd_Click&#34; ValidationGroup=&#34;G1&#34; /&gt; &lt;/FooterTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID=&#34;LinkButton1&#34; runat=&#34;server&#34; OnClick=&#34;LinkButton1_Click&#34;&gt;Remove&lt;/asp:LinkButton&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;asp:Button ID=&#34;Button1&#34; runat=&#34;server&#34; Text=&#34;Save&#34; OnClick=&#34;Button1_Click&#34; ValidationGroup=&#34;G1&#34; /&gt;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/600285/Add-RequiredField-Validator-to-dynamic-TextBoxes-in-ASPNet-GridView-Rows-using-C-and-VBNet/https://www.aspforums.net:443/Threads/600285/Add-RequiredField-Validator-to-dynamic-TextBoxes-in-ASPNet-GridView-Rows-using-C-and-VBNet/Tue, 04 Dec 2018 03:15:33 GMT