Click here to Skip to main content
12,253,679 members (60,561 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
Dear, All
I use SqlDatasoure for showing item on dropdownlist. So, My question is "How to show the title like "Select Level" before the item list i have query from SqlDatasource?"

Appreciated for your kindly help again
Posted 9-Sep-12 7:31am
Edited 9-Sep-12 7:32am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi ,
Check this
    <div>
    <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True"
    ValidationGroup="ss" DataSourceID="SqlDataSource1" DataTextField="name" 
            DataValueField="productID">
<asp:ListItem Text="---select---" Value="0" ></asp:ListItem>
 
 
</asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:testConnectionString %>" 
            SelectCommand="SELECT [productID], [name] FROM [Product]">
        </asp:SqlDataSource>
    </div>
Best Regards
M.Mitwalli
  Permalink  
v2
Comments
Cmajorros 9-Sep-12 13:59pm
   
Thanks you so much.
Mohamed Mitwalli 9-Sep-12 14:00pm
   
Your welcome if it help you accept the answer
__TR__ 10-Sep-12 4:12am
   
+5
Mohamed Mitwalli 10-Sep-12 4:14am
   
Thanks TR :)
Cmajorros 13-Feb-13 11:40am
   
Anyway I have solve my problems already. I just created new page and copy sever side code. It 's work. Although it seems to be a stupid solution,at least It works well. Thank you all guys for your kindly help
Mohamed Mitwalli 16-Feb-13 8:35am
   
your Welcome :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

For such title, use the control System.Web.UI.WebControls.Label:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.aspx[^].

—SA
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hello !
I think you can add the DropDownList item manualy before you connect the SqlDatasource (something is here).

Josef Pospisil
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Anyway I have solve my problems already. I just created new page and copy sever side code. It 's work. Although it seems to be a stupid solution,at least It works well. Thank you all guys for your kindly help
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100