Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Combobox that's populated by Web Service
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01409942
Message ID:
01410041
Vues:
48
You don't have to use the Binding properties in MM in every situation. If it is called for you could do something like this in your click method of the Save button:
DataSet dsTrade = (DataSet)Session["dsTrade"];
if (this.cboAccount.SelectedValue.Length == 0)
{
        this.cboAccount.SelectedValue = "0";
}
this.cboAccount.BindingType = mmBindingType.None;
dsTrade.Tables[0].Rows[0]["AccountID"] = int.Parse(this.cboAccount.SelectedValue);
The above code is referencing a combo box on my form (cboAccount) that I load using similar methods as you mention below, namely, as postbacks to the server based on user actions on other controls. Eventually, the user will need to select one of the values. The reason I set the selected value to '0' is so the business rule will throw back an error stating that this value must be entered. The underlying table (or business object) is Trade and the column is AccountID.

HTH

>Ok, we're coming along now. Here's my next roadblock:
>
>I've got a couple of comboboxes on my web form. When the user selects a value from the first one, I use some Ajax and a web service (using a page method - slick!) to populate the values in the second combobox. It seems to be halfway bound properly to the entity, because when I try to save the entity, it tells me that the value is a string, when it expected an Int32.
>
>So my question is, what should my binding settings be on a combobox that's populated manually?
>
>Thanks!
>
>Eric
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform