473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

controls as variables

I have 10 hyperlinks on an .aspx page. Hyperlink1, hyperlink2, etc.
I want to reference them in a loop to set their visibility and targets.
What I think I want to do is
mylink = 'hyperlink' & i (i being 1 to 10)

and change the string into a hyperlink reference and then do
mylink.target = abc.aspx
mylink.visible = true

I'm an old FoxPro programmer, so I'm lost in finding help on
this.

TIA,
Marc Miller


Nov 18 '05 #1
2 858
1)Put them all into an array, and index into an array
2)Use FindControl method to get the individual hyperlink. This isn't all
that well performing, but may not matter in your case.

Btw, I recommend googling for questions like this, they've been answered
dozens of times.

"Marc Miller" <mm****@hotmail.com> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
I have 10 hyperlinks on an .aspx page. Hyperlink1, hyperlink2, etc.
I want to reference them in a loop to set their visibility and targets.
What I think I want to do is
mylink = 'hyperlink' & i (i being 1 to 10)

and change the string into a hyperlink reference and then do
mylink.target = abc.aspx
mylink.visible = true

I'm an old FoxPro programmer, so I'm lost in finding help on
this.

TIA,
Marc Miller

Nov 18 '05 #2
Marc Miller wrote:
I have 10 hyperlinks on an .aspx page. Hyperlink1, hyperlink2, etc.
I want to reference them in a loop to set their visibility and targets.
What I think I want to do is
mylink = 'hyperlink' & i (i being 1 to 10)

and change the string into a hyperlink reference and then do
mylink.target = abc.aspx
mylink.visible = true


Look at the FindControl() method. Basically you can do a loop like so:

For i as Integer = 1 to 10
Dim hl as HyperLink = FindControl("HyperLink" & i)
If Not hl is Nothing Then
hl.NavigateUrl = ...
...
End If
Next

Additionally, this article would be benefitial reading:
http://www.odetocode.com/Articles/116.aspx

hth

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #3

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

Similar topics

1
312
by: Lalit | last post by:
Hi Friends, We are defining coding standards for our company. In MSDN i have seen that hungarian notation will not be used in naming of variables etc. What about the controls ? Should we...
1
6309
by: Will | last post by:
Hi all. I'm learning VB.Net and am developing a WinForms app. I'm trying to make an app that I will use to scan in one or more than on image. I want to use a tabbed interface to hold each image....
4
2428
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. ...
9
1384
by: Rob Meade | last post by:
Hi all, I have a form which is programmatically created from reading values from a database table. There is a 'form' for each DocumentType - when I say form I mean as in a different form will...
4
2077
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
0
1023
by: ben | last post by:
I am having some difficulty in understanding how to deal with variables, session states, objects, user controls while attempting to develop a ASP.Net application. I have created several user...
3
1025
by: steve | last post by:
Hi I've been wondering for a wile now if its possible to make an application were the user can make a form by inputting data in variables this by using VB.net Example The user gets a dataset...
11
8557
by: radders | last post by:
I've just started working through Sams publishing's "Teach yourself Visual C++ 4 in 21 days", using VC++ version 4.0 on a windows xp machine. My problem occurs when I attempt to add member variables...
2
2193
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
11
1662
by: Web Search Store | last post by:
Hello, I set up a web page with 2 user controls. In classic asp, the first one did all the declarations, and the second one used the values, and could reset it. In ASP.Net so far I can't...
0
7124
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
7326
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,...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
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
5629
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,...
1
5053
isladogs
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...
0
4707
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
1558
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.