I am trying to clear data of multiple ASP Textboxes on clicking Clear button. I was trying with one textbox initially. It is clearing the the textbox data on button-click, but it is also calling the Page_Load method. I want to clear textboxes without calling Page_Load method.
Here is the code, I tried:
<body>
<form id="form1" runat="server">
<script type="text/javascript">
function Clear() {
document.getElementById("<%=txt.ClientID %>").value = "";
return true;
}
</script>
<div>
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<asp:Button ID="btn" runat="server" Text="click" OnClientClick="return Clear();" />
</div>
</form>
</body>