Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web control (combo box, etc.)
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01277117
Message ID:
01277136
Vues:
19
Bob,

>First, when I have a text box that is bound to a database column and is required to be entered (validated via the business object), when leaving the text box empty and saving it the error icon displays and works as desired. However, with a combo box, I would like to have it initialize as empty, thereby forcing the user to respond to it. I expected the error icon to appear (similar to the text box) when the save is issued and nothing had been entered. However, I get a system exception on this saying the selectedvalue property cannot be null. For background the control has a displaymember of a text type and the value member is an int.

You can set the mmDropDownList property "AddBlankEntry" to true which adds a blank entry for you.

>My second question relates to web controls as well. How do you get a combo box to "refresh" or requery from its source? I can load inital values into the combo box in the Page_Load method, but haven't figured out yet how to issue a requery based on user interaction. I have tried putting code in the SelectedIndexChanged event, but it is not firing. I know it is not executing because I put a breakpoint in it and it never reaches it.

That's because by default a DropDownList doesn't post back on SelectedIndexChanged. You have to set its AutoPostBack property to true to make this happen.

>Last, how do I refresh data bound controls on a web form for default values? For example, I create a new record for a business object that has a date field. My business object sets the date to today as a default, but the control that is bound to this column does not update when displayed.

You can call the web form's BindControl() method passing a reference to the control to be rebound.

Happy Holidays to you and yours too!
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform