I am trying to loop through all the controls on my webform to get it's
ID property. My eventual goal is going to be to reset the text of
specific contols.
Here is a piece of the code I am using, that I found searching through
Google:
Dim control As Control
For Each control In Me.Page.Control s
Response.Write( "<BR>" + control.ID)
Next
Unfortunately, all I get returned is the name of my form such as
"frmIndex".
Anyone have any idea or, prefered, an example of what I need to do?
Thanks in advance 3 1269
Controls collection includes only direct children. You should loop
recursively to reach every control.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
<gb********@gma il.comwrote in message
news:11******** **************@ q66g2000hsg.goo glegroups.com.. .
>I am trying to loop through all the controls on my webform to get it's
ID property. My eventual goal is going to be to reset the text of
specific contols.
Here is a piece of the code I am using, that I found searching through
Google:
Dim control As Control
For Each control In Me.Page.Control s
Response.Write( "<BR>" + control.ID)
Next
Unfortunately, all I get returned is the name of my form such as
"frmIndex".
Anyone have any idea or, prefered, an example of what I need to do?
Thanks in advance
On Jun 7, 3:18 am, "Eliyahu Goldin"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
Controls collection includes only direct children. You should loop
recursively to reach every control.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
<gbjornh...@gma il.comwrote in message
news:11******** **************@ q66g2000hsg.goo glegroups.com.. .
I am trying to loop through all the controls on my webform to get it's
ID property. My eventual goal is going to be to reset the text of
specific contols.
Here is a piece of the code I am using, that I found searching through
Google:
Dim control As Control
For Each control In Me.Page.Control s
Response.Write( "<BR>" + control.ID)
Next
Unfortunately, all I get returned is the name of my form such as
"frmIndex".
Anyone have any idea or, prefered, an example of what I need to do?
Thanks in advance- Hide quoted text -
- Show quoted text -
Thanks. Do you have an example, or a link, on how to loop recursively
thru the form?
writeControlIds (Page);
void writeControlIds (Control pc)
{
foreach (Control c in pc)
{
Response.Write( c.ID + "<br />");
writeControlIds (c);
}
}
-- bruce (sqlwork.com) gb********@gmai l.com wrote:
On Jun 7, 3:18 am, "Eliyahu Goldin"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
>Controls collection includes only direct children. You should loop recursively to reach every control.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
<gbjornh...@gm ail.comwrote in message
news:11******* *************** @q66g2000hsg.go oglegroups.com. ..
>>I am trying to loop through all the controls on my webform to get it's ID property. My eventual goal is going to be to reset the text of specific contols. Here is a piece of the code I am using, that I found searching through Google: Dim control As Control For Each control In Me.Page.Control s Response.Write( "<BR>" + control.ID) Next Unfortunately , all I get returned is the name of my form such as "frmIndex". Anyone have any idea or, prefered, an example of what I need to do? Thanks in advance- Hide quoted text -
- Show quoted text -
Thanks. Do you have an example, or a link, on how to loop recursively
thru the form?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Navin |
last post by:
Hello friends...
On a single asp.net web page i have a single server-side form that contains
a couple of user-controls. Each user control has its own functionality and
contains server-side textbox controls, requiredfieldvalidator controls which
validate the textboxes, and a linkbutton control that postbacks the web
page. The problem is, when the user clicks on the linkbutton control on one
user control, the requiredfieldvalidator gets...
|
by: Daniel |
last post by:
I'm new to .Net and all of its abilities so I hope this makes sense.
Basically I'm confused on when is the appropriate time to use web forms
controls vs. regular HTML.
For example in ASP (non-.Net) if I wanted to fill a list it may look
something like this:
-------START CODE
<%
|
by: Bharat |
last post by:
Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify
and cancel the items listed in this control.
Here is how I designed. I used placeholder to add the controls dynamically
to the page on the click...
|
by: Chad |
last post by:
I have a problem that I am desperate to understand.
It involves dynamically adding controls to a Table control that is built as a result of performing a database query.
I am not looking to avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
|
by: Tim::.. |
last post by:
Can someone please help....
I'm having major issues with a user control I'm tring to create!
I an trying to execute a sub called UploadData() from a user control which I
managed to do but for some reason I keep getting the error:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
| |
by: serge calderara |
last post by:
Dear all,
I am new in asp.net and prepare myself for exam
I still have dificulties to understand the difference between server control
and HTML control.
Okey things whcih are clear are the fact that for server control component ,
code is running on the server side.
But if I take as example a Label. I place on a webform an HTM label control
and a WebForm label control, I could see that properties are different for
|
by: Mike Collins |
last post by:
I someone can please help, I am about at an end in trying to figure this out.
I am adding some dynamic controls to my page (I found out that I was supposed
to be doing that in the oninit event, which I am). I now want to read the
text/values of those controls. I have found out that I can read the values if
I wait until Page_Load, but then I have the same questions showing up again
(along with the new questions) and I do not want them to....
|
by: Hexman |
last post by:
Hello All,
I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm
using some VB6 code, .Net2003 code, and .Net2005 code. I'm developing in vb.net 2005.
This test sub just reads an input text file, writing out records to another text file, eliminating records that have a '99' in them (it is similar to
a CSV file).
Some of my concerns are:
|
by: johnlim20088 |
last post by:
Hi,
Hi someone can help me on this?
Currently I have a Listdata.aspx page with datagrid, I wish to export my datagrid content to excel with following code ( with button export click event):-
But when I run the code, it raise an error
-> Control 'ctl02_GridView1' of type 'GridView' must be placed inside a form tag with runat=server"
My Listdata.aspx page are place under MasterPage.aspx, which is inside Contentplace holder. how to...
|
by: =?Utf-8?B?TWlrZQ==?= |
last post by:
Hi Guys,
I have a real serious problem that stoped me doing any progress in my project.
in one of my webpages I have a wizard of more then 13 pages and in every
page some Ajax controls, textboxes, dropdownlists, about 4 panels, where
every page in my wizard have almost the same controls; so all what I had to
do is copy the controls from a wizard page then paste it to next one and just
change the controls names and it was going all fine...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |