Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Default Value for Web Dropdownlist?
Message
De
21/09/2004 14:13:41
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00943169
Message ID:
00944664
Vues:
12
Kevin,

Thanks for the reply and tip. I will add the code to my subclassed control.

This is a good example of code that should be placed on a "Known Issues Page" somewhere. Do you plan on adding this kind of page to your company website?

Terry Carroll


>Terry,
>
>>I have checked the binding properties several times but see no problem. The control works just find when manually selecting a value and navigating records. Only on add and setting default values is the selectedvalue not correct.
>
>I had a chance to take a closer look at this now that I'm back in the office this week. As it turns out the mmDropDownList control is not currently specified to respond to the Added state change event. I'll fix this in the next release, but for now you can do one of two things:
>
>1. Create a subclass of mmDropDownList control, override the StateChangeHandler() method, and check for the Added event. For example:
>
>
public override void StateChangeHandler(OakLeaf.MM.Main.Business.mmBaseBusinessObject bizObj, OakLeaf.MM.Main.Business.mmBusinessStateChangeEventArgs e)
>{
>   if (e == mmBusinessState.Added)
>   {
>      this.OnBindData(bizObj, e, false);
>   }
>   else
>   {
>      base.StateChangeHandler(bizObj, e)
>   }
>}
>
>2. If you want to add the desired behavior to a single form, you can add a state change handler method to the form that binds the control when the business object's Added state change occurs. To do this, create a new method at the form level that checks the current state and if it's Added, binds the control. For example:
>
>
private void Orders_StateChange(mmBaseBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
>{
>	if (e.State == mmBusinessState.Added)
>	{
>		this.BindControl(this.cboShippers, this.cboShippers.BindingValueSource,
>			this.cboShippers.BindingValueSourceMember);
>	}
>}
>
>And then add code to the form's Load that registers the handler method with the business object's StateChange event. For example:
>
>
this.oOrder.StateChange += new mmBusinessStateChangeDelegate(this.Orders_StateChange);
>
>Regards,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform