This is a discussion on How to clear all the textboxes in my form in ASP DOT NET and C#? within the ASP and ASP.NET Programming forums, part of the Web Development category; hi all... can any one help me, How to clear all the textboxes in my form in ASP DOT NET ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hey.. you have to loop thru all the text boxes and set the empty value in it and here is the code for you... foreach (Control ctl in Page.Controls[1].Controls ) { TextBox tb = ctl as TextBox; if (tb!=null) { tb.Text = "" ; } } I hope this will help you...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| hey... here is the sample code for you... <script lang="javascript"> function CheckFunction() { if (document.getElementById('<%=textbox2.ClientID%>') .value == "") { alert("Please enter a value"); return; } } </script> <asp:textbox id="textbox2" runat="Server"></asp:textbox> <input type=button id="btn1" onclick="javascript:CheckFunction();" value="Click"> thanks...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date/Time stamp a form field as the form is submitted | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 01-17-2008 08:47 PM |
| How to Select a record using Listbox and edit/update it's fields using textboxes? | kingmaker | ASP and ASP.NET Programming | 1 | 12-19-2007 09:30 PM |
| How can I clear the form field values after the user has submitted the form for clien | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-01-2007 11:39 PM |
| How can I pass a hidden value to a form and submit that form when a text link is clic | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 10-17-2007 08:07 AM |
| How to clear Session | SaravananJ | C# Programming | 4 | 09-12-2007 02:38 AM |