Link to home
Start Free TrialLog in
Avatar of Ed
EdFlag for United Kingdom of Great Britain and Northern Ireland

asked on

No Data for DropDown List

I have this sub that popultaes a dropdown list

Whats the best way to populate the list with some text 'No data'

if the SP returns no data.

    Private Sub Build_ddlPDMName()

        ddlPDMName.Items.Clear()

        'If Not Page.IsPostBack Then
        Dim dt As New DataTable
        Dim strConnString As String = ConfigurationManager.ConnectionStrings("IrisConnectionString").ConnectionString
        Using myConn As New SqlConnection(strConnString)
            myConn.Open()
            Using cmd = myConn.CreateCommand()
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "[Qual].[Get_Team_Assessors]"
                cmd.Parameters.AddWithValue("@TeamID", ddlTeamName.SelectedValue)
                Using da As New SqlDataAdapter(cmd)
                    da.Fill(dt)

                    dt.
                End Using
            End Using
        End Using

        ddlPDMName.DataSource = dt
        ddlPDMName.DataTextField = "Assessorname"

        ddlPDMName.DataValueField = "AssessorID"


        ddlPDMName.DataBind()


    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ed

ASKER

That is perfect, thanks.