SfWeb Dropdownlist populating


Author
Message
Olivier
Olivier
StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)
Group: StrataFrame Users
Posts: 96, Visits: 805
Hi all,

I don't find any example or tutorial to populating a dropdownlist with a business object.

I try two way :

<SFWebBigGrinropDownList ID="DropDownList1" runat="server" BusinessObjectName="oTMessageBo" DataTextField="TMES_LIBELLE" DataValueField="TMES_ID" >
</SFWebBigGrinropDownList>

or

 <SFWebBigGrinropDownList ID="DDL_TMESSAGE" runat="server">
      <PopulationDataSourceSettings BusinessObjectType="oTMessageBo" DisplayFieldNamesAlternate="TMES_LIBELLE|" DropDownFormatString="" FormatString="{0}" MethodToExecute="GetYesNo;" ValueMember="TMES_ID" />
 </SFWebBigGrinropDownList>

Have you an idea ?

I work in c# asp.net with strata.

thanks
Olivier,



==============================================
Asp.net C# - Strataframe - telerik
==============================================
Michel Levy
Michel Levy
StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Salut Olivier,
Hi Olivier,

quand tu utilises un controle SF aspx pour la première fois, je te conseille de commencer par utiliser le mode de design. Comme ça, tu peux repérer dans la feuille de propriétés ce qui est nécessaire pour cette classe SF.
When you begin with a new SF aspx control, my advice would be to begin with using design mode. I find it more simple, in order to see in the property sheet what is mandatory for this SF class.

par exemple, ici,
as an example, see below



on voit bien qu'il faut renseigner le PopulationType et le PopulationDataSource. Tu commences par le PopulationType, en choisissant "BusinessObject"
One can see that PopulationType and PopulationDataSource are 2 required properties. Set the PopulationType first, by choosing "BusinessObject"

Ensuite, tu peux configurer le PopulationDataSourceSettings, ça te propose un assistant:
Now, you can configure the PopulationDataSourceSettings, you'll see the wizard:



Tu choisis le BO parmi ceux de ton projet, la méthode à éxécuter pour peupler la liste, et les colonnes à afficher.
Choose the BO from the list coming from your project, the method to execute for populate the list, and the columns to show. 

Au final, tu obtiens du code comme celui-ci, par exemple:
Finally, your code should be as this example:



    <SFWeb:DropDownList ID="DropDownList1" runat="server" 
        PopulationType="BusinessObject">
        <PopulationDataSourceSettings BusinessObjectType="TestBO.BOaffaires" 
            DisplayFieldNamesAlternate="ville|anconstruc|" DropDownFormatString="" 
            FormatString="{0}{1}" MethodToExecute="FillDataAllFields;" 
            ValueMember="bi_id" />
    </SFWeb:DropDownList>


Est-ce plus clair?
Olivier
Olivier
StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)StrataFrame User (190 reputation)
Group: StrataFrame Users
Posts: 96, Visits: 805
Hi Michel,

Thanks For your reply,

i don't understand the method : "FillDataAllFields" and after i understand , it's your custom method.

It's work very well.

it's possible to have a filter "where" on executemethod ? to load a several record.
And if possible to add an empty record on the top.


Merci beaucoup michel pour ta réponse.

Je n'avais pas compris la methode FillDataAllFields et puis j'ai compris que c'etait une methode personnel que tu avais faites.
Si tu connais le moyen de faire un where sur la requete dans le populating, car j'ai fait une methode custom aussi.
Et si possible rajouter un enregistrement vide au début du style : "Faites votre choix"

Merci pour tout,

thanks
Olivier,

==============================================
Asp.net C# - Strataframe - telerik
==============================================
Michel Levy
Michel Levy
StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)StrataFrame User (319 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
He he Olivier,

Did you forgot all we've learn on the SF session I gave you? Whistling That method (FillDataAllFields) is the one we wrote together as an example on one of your BOs...

You may write whatever you want in a custom Fill method, including WHERE clause and/or JOIN and/or ORDER, etc etc... all this will run on the SQL server as long the syntax you use is T-SQL syntax for your version of the engine (I mean SQL 2000 will not understand a CTE, for example).
A single BO may host as many custom fill method you need, and all these methods will be available to fill it from within any aspx page based on a default page in which you create an instance of this BO. Simply code what you need in the BO, consume it where you need.
In my own BOs, around half of the fill methods are specifics one for populating DropDownLists, Combos, and lists (I query only the columns I need).

For the empty or additional line on top of the Combo, look at the TopMostDescription property, it is intended for that usage (see also TopMostDropDown and TopMostValue)

-------------------------------------------------------

Oh Olivier,

Tu as oublié tout ce qu'on a vu pendant la formation que j'ai faite chez toi Whistling Cette méthode (FillDataAllFields), c'est celle qu'on a écrite ensemble comme exemple sur un de tes BOs...

Tu peux écrire ce que tu veux dans une méthode Fill, y compris avec des WHERE, des JOIN, des ORDER, etc etc... tout ça sera éxécuté sur le serveur SQL si ta syntaxe respecte le T-SQL de ta version (je veux dire que par exemple un SQL 2000 ne comprendra pas une requète avec une CTE).
Un BO peut héberger autant de requètes Fill personnalisées que tu veux, toutes ces méthodes seront disponibles pour peupler le BO depuis une page aspx dérivée d'une basepage dans laquelle tu auras créé une instance de ce BO. Tu as juste à coder dans le BO, et tu utilises ce que tu veux quand tu en as besoin.
Dans mes BOs, environ la moitié des méthodes fill sont destinées à peupler des listes déroulantes et des combos (je requète uniquement les colonnes dont j'ai besoin).

Pour ce qui concerne la ligne vide ou supplémentaire en haut du combo, regarde la propriété TopMostDescription, elle est justement faite pour ça! (regarde aussi TopMostDropDown et TopMostValue)
Edited 12 Years Ago by Michel Levy
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