User Control

R

rn5a

I already have a user control, named Address.ascx, which displays 4
TextBoxes. As such, there's no problem in rendering these 4 TextBoxes
in a ASPX page. The ASPX page renders the 4 TextBoxes twice - one set
of 4 TextBoxes for their billing address & the other set for their
shipping address. Users come across this ASPX page just before they
finalize their order (a shopping cart application).

Since a user can place multiple orders, they have been given the
provision to view the details of the different orders they have placed
(like the date & time of order, total order amount, products they had
chosen in each of the orders etc.).

Along with these details, I would like to display the billing address &
shipping address a user had provided just before finalizing an order. I
intend to display the billing address & shipping address in 2 Label
controls - one for the billing address & the other one for the shipping
address.

I already have the user control named Address.ascx but it encapsulates
4 TextBoxes & not 4 Labels. What I would like to know is is there any
way by which I can still use this user control (in the ASPX page which
will display the details of the various orders) & somehow cast the 4
TextBoxes into 4 Labels & then display the billing address & shipping
address in those Labels?

I wouldn't like to add the additional 4 Labels in the user control
along with the already existing 4 TextBoxes. The user control should
remain as it is....with the 4 TextBoxes
 
L

Laurent Bugnion

Hi,

I already have a user control, named Address.ascx, which displays 4
TextBoxes. As such, there's no problem in rendering these 4 TextBoxes
in a ASPX page. The ASPX page renders the 4 TextBoxes twice - one set
of 4 TextBoxes for their billing address & the other set for their
shipping address. Users come across this ASPX page just before they
finalize their order (a shopping cart application).

Since a user can place multiple orders, they have been given the
provision to view the details of the different orders they have placed
(like the date & time of order, total order amount, products they had
chosen in each of the orders etc.).

Along with these details, I would like to display the billing address &
shipping address a user had provided just before finalizing an order. I
intend to display the billing address & shipping address in 2 Label
controls - one for the billing address & the other one for the shipping
address.

I already have the user control named Address.ascx but it encapsulates
4 TextBoxes & not 4 Labels. What I would like to know is is there any
way by which I can still use this user control (in the ASPX page which
will display the details of the various orders) & somehow cast the 4
TextBoxes into 4 Labels & then display the billing address & shipping
address in those Labels?

I wouldn't like to add the additional 4 Labels in the user control
along with the already existing 4 TextBoxes. The user control should
remain as it is....with the 4 TextBoxes

I don't think that you can cast from TextBox to Label. If I were you,
I'd try showing the same control, but in "read-only" mode.

HTH,
Laurent
 
E

Eliyahu Goldin

What you can do is to add to the user control a property that will tell
whether you want textbox-like or label-like look. Depending on the property,
style the textboxes to appropriate appearance with css.
 
A

apathetic

I already have the user control named Address.ascx but it encapsulates
4 TextBoxes & not 4 Labels.

You could replace these controls with the asp:placeHolder control and
then programmatically insert either a label or a text box depending on
your requirements (most likely by giving your controls a ReadOnly property).

apathetic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top