locked
Empty message in dropdownlist when bind with sqldatasource1 RRS feed

  • Question

  • User1898866688 posted

    Hi all,

    i have a dropdownlist that bind with sqldatasource1.

    everytime i load this page, dropdownlist will display directly the content of data.

    However, what i want is display empty message like --Please select your currency-- by default.

    any idea?

    any help is appreciated.

    Thank you.

    regards

    nasri.

    Friday, March 25, 2011 11:20 PM

Answers

  • User77042963 posted
     <asp:DropDownList ID="ddl1" runat="server"  DataSourceID="SqlDataSource1"   DataTextField="SomeValue" DataValueField="SomeID"    AppendDataBoundItems="True" >        
    <asp:ListItem Value="-1" Selected="True">--Please select your currency-- </asp:ListItem>  </asp:DropDownList>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 25, 2011 11:49 PM
  • User-2067077449 posted

     

     

    <

    asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true">

     

    <asp:ListItem Text="Select anything" Selected="True"></asp:ListItem>

     

    </asp:DropDownList>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 26, 2011 12:17 AM

All replies

  • User77042963 posted
     <asp:DropDownList ID="ddl1" runat="server"  DataSourceID="SqlDataSource1"   DataTextField="SomeValue" DataValueField="SomeID"    AppendDataBoundItems="True" >        
    <asp:ListItem Value="-1" Selected="True">--Please select your currency-- </asp:ListItem>  </asp:DropDownList>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 25, 2011 11:49 PM
  • User-2067077449 posted

     

     

    <

    asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true">

     

    <asp:ListItem Text="Select anything" Selected="True"></asp:ListItem>

     

    </asp:DropDownList>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 26, 2011 12:17 AM
  • User1898866688 posted

    Thanks Limno and Ravi. Laughing

    Saturday, March 26, 2011 6:36 AM