none
FIM 2010 dropdownlist in RCDC

    Question

  • Hi,

    I have added a Dropdownlist control with two options in UserEdit. However a empty value gets displayed by default and below it are the actual options. I want to eliminate the empty value in drop down. Can anyone help?


    Dolly

    lundi 22 avril 2013 11:55

Toutes les réponses

  • Hi Dolly 

    Did you hard code the options in the RCDC for UserEdit? Could you post the code you have for the RCDC ?

    Rob

    lundi 22 avril 2013 15:08
  • Hi Rob,

    Below is my code:

    <my:Control my:Name="Activation" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=Activation.DisplayName}" my:Description="{Binding Source=schema, Path=Activation.Description}" my:AutoPostback="true">

         <my:Options>

           <my:Option my:Value="true" my:Caption="Activate in DS1" />

           <my:Option my:Value="false" my:Caption="Activate in DS2" />

         </my:Options>

         <my:Properties>

           <my:Property my:Name="ValuePath" my:Value="Value"/>

           <my:Property my:Name="CaptionPath" my:Value="Caption"/>

           <my:Property my:Name="HintPath" my:Value="Hint"/>

           <my:Property my:Name="ItemSource" my:Value="Custom"/>

           <my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=Activation, Mode=TwoWay}"/>

         </my:Properties>

       </my:Control>

    where "Activation" is a boolean attribute.


    Dolly

    mardi 23 avril 2013 03:15
  • Hi 

    Ok so the problem here is that you are using a dropdown for your boolean attribute. Boolean attribute can actually have three values. These are usually "true" or "false" or null.

    so the blank option you are seeing is the default null value. The only way you are going to get rid of it is to set one of your values as the default value. code should be something like this <my:Property my:Name="DefaultValue" my:Value="false"/>

    mardi 23 avril 2013 07:26
  • Hi Aleric,

     

    Even adding the default value property didnot help in removing the empty option from dropdownlist.


    Dolly

    mardi 23 avril 2013 08:46
  • Hi 

    did you do and IISRESET on the portal server after adding the default value?

    mardi 23 avril 2013 09:28
  • Yes I did, but no change

    Dolly

    mardi 23 avril 2013 10:25
  • Hi 

    The option will always be there because a boolean always has three options. True, False and null. Setting the default value should only set the option of false (in your case "Activate in DS2") when the page initially loads

    Usually for booleans checkbox controls are used for this reason, that way the user will only ever see a checked box or not. the null is not visible.

    mardi 23 avril 2013 12:04