How to add select word at 0 index while using sqldatasource and Dropdownliast
Write the property of dropdownlist.
AppendDataBoundItems="true"
Now write next line
< asp:ListItem Selected="true" Text="Select one" Value="-1" />
Full code is
< asp:DropDownList ID="DropDownList1" EnableCaching="false" runat="server" DataSourceID="CompSource" DataTextField="CName" DataValueField="ID" Width="300px" AutoPostBack="true" AppendDataBoundItems="true"> < asp:ListItem Selected="true" Text="Select one" Value="-1" />
< asp:SqlDataSource ID="CompSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnection %>" SelectCommand="SPSelect" SelectCommandType="StoredProcedure"> < SelectParameters> < asp:Parameter DefaultValue="false" Name="Del" Type="Boolean" /> < asp:Parameter DefaultValue="True" Name="Show" Type="Boolean" />
asp:SqlDataSource>
http://
http://
Contributed by:
Rohit kakria
I am software developer
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=317
Click here to go on website
|