Bind null data in DropDownList


Author
Message
Vincent C.
Vincent C.
StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)
Group: Forum Members
Posts: 2, Visits: 10
Hi, i'm a really Strataframe beginner (in english too) and i learn for 3 weeks on the c-sharps sample (great thanks for that !! )



my first really big problems is to have a form with data bind on a table (name: Championnat), this form contain a dropdownlist bind on a key from a child table (name: TypeChampionnat)

here it is




PopulationType="BusinessObject" Width="175px"

BusinessObjectName="BOChampionnats" BindingField="c_TypeChamp">


displayfieldnamesalternate="Libelle|" dropdownformatstring=""

formatstring="{0}" methodtoexecute="FillTypeChampionnat;" valuemember="Code">






c_TypeChamp: the foreign key

FillTypeChampionnat: the method that fill the list



When i try to add() a new record in the business object it raise an exception



[ArgumentOutOfRangeException: 'lstTypeChampionnat' a un SelectedValue qui n'est pas valide, car il n'existe pas dans la liste des éléments.

Nom du paramètre : value]

System.Web.UI.WebControls.ListControl.set_SelectedValue(String value) +1827626





i know it's "normal" because the field c_TypeChamp is null

i know i can set a default value in the method "_SetDefaultValues()" BUT i don't want to set a default value BigGrin



so what can i do ??



a solution in asp.net forum is to populate manualy the dropdownlist with a default "-1" value with
AppendDataBoundItems="True"


and

ListItem Selected="True" Text="" Value="-1"




but it generate the error

Générer (web): Vous ne pouvez pas utiliser la collection par défaut 'Items' de MicroFour.StrataFrame.UI.Web.DropDownList sans les balises de propriété lorsque vous utilisez une version filtrée de la même collection.




thanks for your help

and thanks to Michel Levy to introduce me to strataframe Tongue
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search