473,441 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

page controls

Das
Hi All,
Where does asp.net stores the objects declared in the page.
I have a method where I want to loop through all the controls(textbox, HtmlInputText) within the page.
I want to in which collection these (textbox,HtmlInputText) are stored

thanks in advance..
das
Nov 16 '05 #1
2 4295
this.Controls

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Das" <Da*@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
Hi All,
Where does asp.net stores the objects declared in the page.
I have a method where I want to loop through all the controls(textbox, HtmlInputText) within the page. I want to in which collection these (textbox,HtmlInputText) are stored

thanks in advance..
das

Nov 16 '05 #2
Hi Das,
First of all if you want to validate the controls in the page you better
use the mechanism present in ASP.NET for that, believe me it's MUCH more
flexible that what you are doing.

Now to iterate in ALL the controls present in a page you start with
Page.Controls , and for each of the controls you find you have to check its
own Controls collection , remember that there are several controls ( Panel,
PlaceHolder, etc) that contains other controls. They are designed using the
composite pattern.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Das" <Da*@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
Hi,
I'm Iterating through all the items in the collection but it only shows me three objects. on button click I'm passing the method like :

validatePage(this.controls)

the method for Iterating throught the controls is given below:

public static bool validatePage(ControlCollection controls)
{
foreach(Control control in controls )
{
if(control.ToString().Equals("System.Web.UI.WebCon trols.TextBox"))
{
if(((TextBox)control).Text.IndexOf("'")!=-1)
return false;
}
else if(control.ToString().Equals("System.Web.UI.HtmlCo ntrols.HtmlInputText")) {
if(((HtmlInputText)control).Value.IndexOf("'") != -1)
return false;
}
}

return true;

}

There are more than 30 controls on the form. I'm want to go thourgh each control within the page. but the controls are within the table does that effect adding controls in the collection.
thanks,
das

"Tamir Khason" wrote:
this.Controls

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Das" <Da*@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
Hi All,
Where does asp.net stores the objects declared in the page.
I have a method where I want to loop through all the controls(textbox,

HtmlInputText) within the page.
I want to in which collection these (textbox,HtmlInputText) are stored
thanks in advance..
das


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: Bas Groeneveld | last post by:
I am developing an ASP.NET application part of which consists of a data entry wizard defined by entries in a data table - ie the controls on each page of the wizard are determined by definitions in...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
5
by: Joe Reazor | last post by:
I've got an asp.net page that has approximately 1,440 controls on it. You must think I'm crazy, but we need to have the page organized in this fashion. As you can imagine, the page takes a very...
11
by: Frank Esser | last post by:
Hi, I created an ASP.NET page (test.aspx) with some web controls in GridLayout (Design time). When I look at the collection page.controls by foreach (Control ctrl in Page.Controls) { ....
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.