Hi Try this code..
Get the parent Container like Div or Panel or any.. and iterate from that.
Example:
<div id="divContainer" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
'
'
'
<asp:TextBox ID="TextBox20" runat="server"></asp:TextBox>
</div>
Code Behind:
protected void Button1_Click(object sender, EventArgs e)
{
foreach (var item in divContainer.Controls)
{
if (item is TextBox)
{
(item as TextBox).Text = "";
}
}
}
If you want to do it in
JQuery :
<script type="text/javascript">
var ClearAllTextBoxes = function () {
$('input[type=text]').val('');
}
</script>