Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Web control (combo box, etc.)
Message
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Web control (combo box, etc.)
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01277117
Message ID:
01277117
Views:
52
Kevin,

I have a couple of questions regarding user controls on Web Forms:

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.

Do I need to initialize this value (and if so how should this be accomplished) so that I can get the business object to return the error that this field needs to be entered?

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.

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.

Thanks in advance and Happy Holidays to you and your family.
Next
Reply
Map
View

Click here to load this message in the networking platform