Can I set default prompt text for an asp.net dropdownlist control?

Shepwedd
Shepwedd used Ask the Experts™
on
I have written the attached code within the frontend of my asp.net C# web site using visual studio 2008. Is it possible to set prompt text in the dropdownlist ("Please select from...") without actually writting the text within my database table?
<asp:DropDownList 
                                                                    ID="PartnerInsertDDL" 
                                                                    runat="server" 
                                                                    CssClass="ddlPartnerFeeExec" 
                                                                    DataTextField="PartnerDescription" 
                                                                    DataValueField="PartnerCode" 
                                                                    DataSourceID="PartnerInsertDataSource">
                                                                </asp:DropDownList>
                                                                <asp:LinqDataSource 
                                                                    ID="PartnerInsertDataSource" 
                                                                    ContextTypeName="TrustSystemDataContext" 
                                                                    TableName="PartnerLookups" 
                                                                    runat="server"/>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
Commented:
Here you go:
<asp:DropDownList ID="PartnerInsertDDL" runat="server" CssClass="ddlPartnerFeeExec"
            DataTextField="PartnerDescription" DataValueField="PartnerCode" DataSourceID="PartnerInsertDataSource"
            AppendDataBoundItems="True">
            <asp:ListItem Value="Please select from...">Please select from...</asp:ListItem>
        </asp:DropDownList>

Author

Commented:
Of course!

Thank you.
yes it is possible to add the text from Code behind file

its something like

dropdownID, items.insert("0","Select an item")

example

<asp:dropdownlist id="EEddl" runat="server"> </asp:dropdownlist>

then

EEddl.items.insert ("0", "Please select from...")


this would definitely help you

thanks



you could just wait for a minute...!!! i also written a perfect solution

Nevertheless, its ok, nothing can be done...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial