Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2004, 08:17 AM
Authorized User
 
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ctranjith
Default clearing Controls

How can I write a general procedure which will clear all the controls in the form passed to the function in asp.net

Expecting Replay

 
Old October 20th, 2004, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

for intI As Integer = Page.FindControl("<form id>").Controls.Count -1 To 0 Step -1
  Page.FindControl("<form id>").Controls.RemoveAt(intI)
Next

Something like that.

Brian
 
Old October 20th, 2004, 01:45 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What do you mean by "clear"? Do you mean to remove the controls or to "reset" them? If you want to remove the controls, you can just call Me.Controls.Clear()
 
Old October 20th, 2004, 03:47 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

How could you just clear the values from all the controls on the page?

 
Old October 23rd, 2004, 12:35 AM
Authorized User
 
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ctranjith
Default

Sorry
Actually
I need to clear the contents of all text box in the given page
How it is possible by using a general function and call that function by passing name of a perticular page

 
Old October 25th, 2004, 07:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Create a function that takes a reference of a textbox, as such:

Public Sub ClearTextBox(ByRef tb As TextBox)
  tb.Text = String.Empty
End Sub

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
clearing out the form x_ray VB.NET 2002/2003 Basics 9 February 21st, 2006 04:44 PM
clearing the form europhreak Dreamweaver (all versions) 1 September 18th, 2005 03:35 AM
Clearing a LOGON_USER kgould Classic ASP Basics 0 February 10th, 2005 10:46 PM
Clearing TextBoxes peevee12 C# 2 June 17th, 2004 11:02 AM
Clearing a Form jbenson001 ASP.NET 1.x and 2.0 Application Design 2 December 3rd, 2003 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.