Link to home
Start Free TrialLog in
Avatar of Shepwedd
Shepwedd

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shepwedd
Shepwedd

ASKER

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...