Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net 2.0 html control

Status
Not open for further replies.

shams123

Programmer
Jan 27, 2006
81
MY
Hi guys,

I have written a page in 1.1 which simply traverses all the controls in the form using

HtmlForm form = (HtmlForm)Page.FindControl("form1");
foreach (Control Ctrl in form.Controls)
{}

Now, I am using 2.0 framework and this page is using a master template. I read that the form's called aspnet. However, I can't seem to get this bit working:

HtmlForm form = (HtmlForm)Page.FindControl("aspnet");
foreach (Control Ctrl in form.Controls)
{}

I would appreciate any help over this.

Thanks
 
Hi,
This is one way ( VB):

Sub FindControls(sender As Object, e As EventArgs)
Dim Fctl As Control
For each Fctl in aspnet.Controls
........<some processing in here based on what is found>
Next

End Sub

Assumes a
<form id="aspnet" runat="server">

identifies your form's start..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top