The controls Visual Studio doesn't want you to see

  • Thread starter Thread starter Harlan Messinger
  • Start date Start date
H

Harlan Messinger

Stick a ListView inside another ListView's ItemTemplate, or stick a
Panel inside the LoggedInTemplate of a LoginView, and good luck finding
it and being able to manipulate it in Design view! This is causing me
all kinds of difficulty.

I have an ASP.Net page that uses a ListView, using the Grid layout, to
display the bids that have been made an item being sold at an auction.
Each row shows the name of the bidder and the amount of the bid. There's
an Insert row at the bottom, which has a TextBox for a bidder to write
in the amount he wants to bid before he hits the Submit button.

There are some items at this auction which aren't really being
auctioned: a fixed price has been set for them (Item.isFixed, a
Boolean). For those, I want to be able to display the item's fixed price
as a Label instead of providing a TextBox for data entry. (The Item data
has a MinBid field which contains the lowest amount for which a bid will
be accepted. For a fixed-price item, MinBid contains the fixed price.)
In other words, for fixed-price items, the bidder doesn't have to enter
anything--he just has to click the Submit button to have his bid recorded.

I figure the answer is either (a) programmatically check whether the
item is fixed-price or not and add either a Label or a TextBox to the
table cell, or (b) to have both an empty TextBox and a Label, but to set
the Visible property of one of them to "true" and the other to "false".
I have no idea how to get either of these to happen. Who can help me
with that?

Another question: how do I populate the TextBox in the InsertRow with a
programmatically determined default (for example, the amount of the
previous bid plus $5)?
 
Harlan said:
Stick a ListView inside another ListView's ItemTemplate, or stick a
Panel inside the LoggedInTemplate of a LoginView, and good luck finding
it and being able to manipulate it in Design view! This is causing me
all kinds of difficulty.

I have an ASP.Net page that uses a ListView, using the Grid layout, to
display the bids that have been made an item being sold at an auction.
Each row shows the name of the bidder and the amount of the bid. There's
an Insert row at the bottom, which has a TextBox for a bidder to write
in the amount he wants to bid before he hits the Submit button.

There are some items at this auction which aren't really being
auctioned: a fixed price has been set for them (Item.isFixed, a
Boolean). For those, I want to be able to display the item's fixed price
as a Label instead of providing a TextBox for data entry. (The Item data
has a MinBid field which contains the lowest amount for which a bid will
be accepted. For a fixed-price item, MinBid contains the fixed price.)
In other words, for fixed-price items, the bidder doesn't have to enter
anything--he just has to click the Submit button to have his bid recorded.

I figure the answer is either (a) programmatically check whether the
item is fixed-price or not and add either a Label or a TextBox to the
table cell, or (b) to have both an empty TextBox and a Label, but to set
the Visible property of one of them to "true" and the other to "false".
I have no idea how to get either of these to happen. Who can help me
with that?

Another question: how do I populate the TextBox in the InsertRow with a
programmatically determined default (for example, the amount of the
previous bid plus $5)?

I've discovered the joys of the ItemCreated event,
ListViewItemEventArgs.Item, ListViewItemEventArgs.Item.ItemType, and
DataKeys. But it took me an awfully long time to locate all this
information as responsive to my questions. That just shows how used I've
become to relying on Intellisense to just list all my choices and let me
figure out what's there that sounds like it will serve the purpose.
 
Back
Top