共用方式為


Adding a ListItem to a dynamic dropdown list

If you manually add a listitem to a dynamic dropdown list, ensure that you set the appenddatabounditems attribute to true.  If you don’t, the dynamic items will overwrite the ones you manually added.

<asp:dropdownlist id="DevelopmentCycleDropDown" runat="server" appenddatabounditems="True" datasourceid="ObjectDataSourceDevelopmentCycle"

        datatextfield="Name" datavaluefield="Id" selectedvalue='<%# Bind(’DevelopmentCycleId’) %>'>

            <asp:listitem selected="True" text="Select Cycle" value="0"></asp:listitem>

        </asp:dropdownlist>