Click here to Skip to main content
Rate this: bad
good
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 8:31am
Edited 9-Sep-12 8: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 at 9-Sep-12 13:59pm
   
Thanks you so much.
Mohamed Mitwalli at 9-Sep-12 14:00pm
   
Your welcome if it help you accept the answer
__TR__ at 10-Sep-12 4:12am
   
+5
Mohamed Mitwalli at 10-Sep-12 4:14am
   
Thanks TR :)
Cmajorros at 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 at 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
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2014
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