IT Community - Software Programming, Web Development and Technical Support

How to clear all the textboxes in my form in ASP DOT NET and C#?

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-20-2007, 07:04 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default How to clear all the textboxes in my form in ASP DOT NET and C#?

hi all...

can any one help me,

How to clear all the textboxes in my form in ASP DOT NET and C#?


thanks in advance...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-20-2007, 07:12 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Default Re: How to clear all the textboxes in my form in ASP DOT NET and C#?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-20-2007, 07:19 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default How to get the textbox ( ASP .Net and C# .Net) value at the client side ?

Hi Sathish..


How to get the textbox ( ASP .Net and C# .Net) value at the client side ?


thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-20-2007, 07:23 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Default Re: How to clear all the textboxes in my form in ASP DOT NET and C#?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 09:00 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0