Connecting Tech Pros Worldwide Forums | Help | Site Map

declaring buttons in array format

Newbie
 
Join Date: Mar 2007
Posts: 22
#1: Dec 2 '07
vb 2005
what i have is an interface designed to act like an order form at a bookstore, like the one a clerk would use to ring up a customer for books. The btnList button connects all the textboxes in the gui to an msaccess database with all the information about pricing and what courses the textbooks correlate to. the best way for me to describe it is a row of textboxes for inputs for isbn#, textbook name, the course it correlates to, pricing, quantity etc. with three buttons to the right of this row in line with it. what i want to do is have an "add" button amongst those three buttons to the right which will add the item to the total and create a new row of textboxes and a new set of three buttons. the only way i can think of to do this would be to use arrays to define the controls (textboxes and buttons), but, apparently, in 2005 and .net, you can't declare a control in an array. so my question is how do i sidestep declaring the controls in an array without devoting 500 pages of code to this one process?

nateraaaa's Avatar
Expert
 
Join Date: May 2007
Location: Illinois
Posts: 663
#2: Dec 4 '07

re: declaring buttons in array format


You could use asp:panel control to hide the buttons you don't need until the Add button is clicked. Then when the user clicks the Add button turn the visible property of your panel to true and display the other controls (buttons and textboxes) within your panel. Should be pretty straightforward.

Nathan
Newbie
 
Join Date: Mar 2007
Posts: 22
#3: Dec 5 '07

re: declaring buttons in array format


how does the asp:panel control work? i've never heard of this
nateraaaa's Avatar
Expert
 
Join Date: May 2007
Location: Illinois
Posts: 663
#4: Dec 5 '07

re: declaring buttons in array format


Quote:

Originally Posted by captainphoenix

how does the asp:panel control work? i've never heard of this

That is basically an html panel with a runat=server. This way you can create a panel put any controls that you want inside of it (textboxes, buttons, labels, etc...) and then hide all of those controls until a certain event happens. Then lets say a button is clicked you change the visibility of your panel to true which will display all of the controls within the panel (unless the visible property of a control in the panel is set to false). See this site for an example of using a panel control.

panel control example

Nathan
Reply


Similar .NET Framework bytes