473,387 Members | 1,749 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,387 software developers and data experts.

I'm Missing SAomething Here

I have an asp page with several pairs of labels and textboxes. If the user
takes a specific action, I want to hide all text boxes and labels with IDs
of "Label4" through "Label13". I am using the subroutine below to try to
accomplish this but only the txt boxes age getting hidden? As you can see in
the code, when the loop to hide the labels did not work I manually coded
that and the labels are still visible?

What did I overlook?

====================== Code ======================
Private Sub HideDataFields()

Dim frmCntrl As Control

Dim cntrl As Control

Dim txtbox As System.Web.UI.HtmlControls.HtmlInputText

frmCntrl = Page.FindControl("Form1")

For Each cntrl In frmCntrl.Controls

If TypeOf cntrl Is System.Web.UI.HtmlControls.HtmlInputText Then

'txtbox = cntrl

cntrl.Visible = False

'Response.Write(txtbox.ID & ":" & txtbox.Value & ":" & txtbox.Name & "<br>")

End If

Next

Dim jj As Integer

For Each cntrl In frmCntrl.Controls

For jj = 4 To 13

If cntrl.ID = "Label" + jj Then

cntrl.Visible = False

End If

Next

Next

Label4.Visible = False

Label5.Visible = False

Label6.Visible = False

Label7.Visible = False

Label8.Visible = False

Label9.Visible = False

Label10.Visible = False

Label11.Visible = False

Label12.Visible = False

Label13.Visible = False

Panel2.Visible = False

End Sub
Nov 21 '05 #1
5 979
Sorry - that should have said that I am working on an "aspx" page - NOT an
asp page

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
I have an asp page with several pairs of labels and textboxes. If the user
takes a specific action, I want to hide all text boxes and labels with IDs
of "Label4" through "Label13". I am using the subroutine below to try to
accomplish this but only the txt boxes age getting hidden? As you can see in the code, when the loop to hide the labels did not work I manually coded
that and the labels are still visible?

What did I overlook?

====================== Code ======================
Private Sub HideDataFields()

Dim frmCntrl As Control

Dim cntrl As Control

Dim txtbox As System.Web.UI.HtmlControls.HtmlInputText

frmCntrl = Page.FindControl("Form1")

For Each cntrl In frmCntrl.Controls

If TypeOf cntrl Is System.Web.UI.HtmlControls.HtmlInputText Then

'txtbox = cntrl

cntrl.Visible = False

'Response.Write(txtbox.ID & ":" & txtbox.Value & ":" & txtbox.Name & "<br>")
End If

Next

Dim jj As Integer

For Each cntrl In frmCntrl.Controls

For jj = 4 To 13

If cntrl.ID = "Label" + jj Then

cntrl.Visible = False

End If

Next

Next

Label4.Visible = False

Label5.Visible = False

Label6.Visible = False

Label7.Visible = False

Label8.Visible = False

Label9.Visible = False

Label10.Visible = False

Label11.Visible = False

Label12.Visible = False

Label13.Visible = False

Panel2.Visible = False

End Sub

Nov 21 '05 #2
I'm wondering if the postback is resetting everything on you?
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Sorry - that should have said that I am working on an "aspx" page - NOT an
asp page

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
I have an asp page with several pairs of labels and textboxes. If the
user
takes a specific action, I want to hide all text boxes and labels with
IDs
of "Label4" through "Label13". I am using the subroutine below to try to
accomplish this but only the txt boxes age getting hidden? As you can see

in
the code, when the loop to hide the labels did not work I manually coded
that and the labels are still visible?

What did I overlook?

====================== Code ======================
Private Sub HideDataFields()

Dim frmCntrl As Control

Dim cntrl As Control

Dim txtbox As System.Web.UI.HtmlControls.HtmlInputText

frmCntrl = Page.FindControl("Form1")

For Each cntrl In frmCntrl.Controls

If TypeOf cntrl Is System.Web.UI.HtmlControls.HtmlInputText Then

'txtbox = cntrl

cntrl.Visible = False

'Response.Write(txtbox.ID & ":" & txtbox.Value & ":" & txtbox.Name &

"<br>")

End If

Next

Dim jj As Integer

For Each cntrl In frmCntrl.Controls

For jj = 4 To 13

If cntrl.ID = "Label" + jj Then

cntrl.Visible = False

End If

Next

Next

Label4.Visible = False

Label5.Visible = False

Label6.Visible = False

Label7.Visible = False

Label8.Visible = False

Label9.Visible = False

Label10.Visible = False

Label11.Visible = False

Label12.Visible = False

Label13.Visible = False

Panel2.Visible = False

End Sub


Nov 21 '05 #3
Wayne,

Funny, two times quickly behind each other.

I wrote this some lines above to a message above to Jason as well who was
doing a webpage as well. Probably the JavaScript background.

Don't use the + to concatinate strings in VBNet. It is not always working as
you expect when there are numbers involved. Use the &

If cntrl.ID = "Label" & jj.ToString Then

I hope this helps,

Cor
Nov 21 '05 #4
Interesting - I'll try that

Wayne

"Cor Ligthert" <no************@planet.nl> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
Wayne,

Funny, two times quickly behind each other.

I wrote this some lines above to a message above to Jason as well who was
doing a webpage as well. Probably the JavaScript background.

Don't use the + to concatinate strings in VBNet. It is not always working as you expect when there are numbers involved. Use the &

If cntrl.ID = "Label" & jj.ToString Then

I hope this helps,

Cor

Nov 21 '05 #5
Thanks for the response Tony. I wonder the same thing but hiding the
textboxes works fine?

Wayne

"Tony" <To************@msn.com> wrote in message
news:O2***************@TK2MSFTNGP15.phx.gbl...
I'm wondering if the postback is resetting everything on you?
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
Sorry - that should have said that I am working on an "aspx" page - NOT an asp page

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
I have an asp page with several pairs of labels and textboxes. If the
user
takes a specific action, I want to hide all text boxes and labels with
IDs
of "Label4" through "Label13". I am using the subroutine below to try to accomplish this but only the txt boxes age getting hidden? As you can see
in
the code, when the loop to hide the labels did not work I manually

coded that and the labels are still visible?

What did I overlook?

====================== Code ======================
Private Sub HideDataFields()

Dim frmCntrl As Control

Dim cntrl As Control

Dim txtbox As System.Web.UI.HtmlControls.HtmlInputText

frmCntrl = Page.FindControl("Form1")

For Each cntrl In frmCntrl.Controls

If TypeOf cntrl Is System.Web.UI.HtmlControls.HtmlInputText Then

'txtbox = cntrl

cntrl.Visible = False

'Response.Write(txtbox.ID & ":" & txtbox.Value & ":" & txtbox.Name &

"<br>")

End If

Next

Dim jj As Integer

For Each cntrl In frmCntrl.Controls

For jj = 4 To 13

If cntrl.ID = "Label" + jj Then

cntrl.Visible = False

End If

Next

Next

Label4.Visible = False

Label5.Visible = False

Label6.Visible = False

Label7.Visible = False

Label8.Visible = False

Label9.Visible = False

Label10.Visible = False

Label11.Visible = False

Label12.Visible = False

Label13.Visible = False

Panel2.Visible = False

End Sub



Nov 21 '05 #6

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

Similar topics

102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
0
by: Jigar.Patel | last post by:
I have simple remoting server exposing following simple method. When I try to add webreference to this server in another project, it gives me following error: Custom tool error: Unable to import...
4
by: Mahesh BS | last post by:
Hello, I need to write a query to find out a set of missing number in a given sequence. Eg : a Column in some table has the following data
5
by: le0 | last post by:
Hello guys, Im really having a hard time doing this, I have a record set with the ItemNo field with the data type as Text. In the record that I have, I want to find the missing number in the...
1
by: BobPaul | last post by:
I'm following code out of a howto book and this is really bugging me. This header file was created by VStudio 6.0 when I did a "Right Click: Add Member Function" CLine is a class I wrote (per the...
0
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a...
3
by: Fred Chateau | last post by:
Still working on my XML DataSet... Having moved on past difficult and complex problems, resolved with the assistance of everyone here, I find myself facing yet another problem. My XML document...
2
by: im2cre8iv | last post by:
Here is my code where I am receiving the error: #include <fstream> #include "BinaryTree.h" using namespace std; Node* BinaryTree::MakeTree(ifstream& infile) { char name; infile>>name;
5
by: fennychieck | last post by:
dear all, i've a problem here. everytime a user click on "approve" button, they'll always get database error. and when i check the error log, there are several fields that have missing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.