Welcome to Dream.In.Code
Become an Expert!

Join 150,192 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,038 people online right now. Registration is fast and FREE... Join Now!




clearing all input box values

 
Reply to this topicStart new topic

clearing all input box values

krishna_iil
12 Sep, 2008 - 03:09 AM
Post #1

New D.I.C Head
*

Joined: 12 Sep, 2008
Posts: 1

hai every one , i am creating a web application in C#.Net
in my form i am using Html textbox (Hthlinputtext) i want to clear all values in the inputtext when i press reset button what i used for clearing is

CODE

foreach(Control control in this.Controls)

{

if(control.GetType() == typeof(HtmlInputText))

{

control.value= "";

}

}

it is not working can somebody help me with this
User is offlineProfile CardPM
+Quote Post

eclipsed4utoo
RE: Clearing All Input Box Values
12 Sep, 2008 - 04:30 AM
Post #2

D.I.C Addict
Group Icon

Joined: 21 Mar, 2008
Posts: 544



Thanked: 29 times
Dream Kudos: 125
My Contributions
wouldn't it be this?

csharp

control.Text = "";

User is offlineProfile CardPM
+Quote Post

zakary
RE: Clearing All Input Box Values
12 Sep, 2008 - 04:42 AM
Post #3

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 419



Thanked: 8 times
Dream Kudos: 175
My Contributions
eclipsed4utoo is correct. I would recommend using string.Empty; It does the same as "" it's just easier to read.

csharp

control.Text = string.Empty;

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Clearing All Input Box Values
12 Sep, 2008 - 04:57 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to ASP.NET smile.gif

Also, I would do this with JavaScript, there's really no need for a trip to the server to clear out some TextBoxes
User is offlineProfile CardPM
+Quote Post

eclipsed4utoo
RE: Clearing All Input Box Values
12 Sep, 2008 - 07:35 AM
Post #5

D.I.C Addict
Group Icon

Joined: 21 Mar, 2008
Posts: 544



Thanked: 29 times
Dream Kudos: 125
My Contributions
QUOTE(PsychoCoder @ 12 Sep, 2008 - 08:57 AM) *

Moved to ASP.NET smile.gif

Also, I would do this with JavaScript, there's really no need for a trip to the server to clear out some TextBoxes


agreed.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:20AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month