dropdownlist initial value

D

DC Gringo

I have a dropdownlist that is bound to a recordset. The default selected
item has turned out to be the first record in my table. I need a row that
has value = 0 and text showing "--ALL".

How can I do this?

<asp:dropdownlist id="Provinces" runat="server" Font-Size="8pt"
Width="100px"></asp:dropdownlist>

Sub BindData()

Dim myDataSet5 As New DataSet
Dim myDataAdapter5 As New SqlDataAdapter(_sqlStmt5, conString)
myDataAdapter5.Fill(myDataSet5, "CommunitiesT2")
ddlCommunities.DataSource = myDataSet5.Tables("CommunitiesT2")
ddlCommunities.DataMember = "CommunitiesT2"
ddlCommunities.DataTextField = "clnName"
ddlCommunities.DataValueField = "clnGUID"
ddlCommunities.DataBind()

End Sub
 
S

Stan Sainte-Rose

Hi,

Try to add a new row with --All as clnName and 0 as nlgGUID into your
datatable before fill out your datatable..I should be work..


Stan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top