473,320 Members | 1,982 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,320 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 4291
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.