Dropdownlist & to &amp RRS feed

  • Question

  • User-49671077 posted

    I have  database field value: "kma & awx"

    in Dropdownlist popup show "kma &amp ; awx"

    <asp:DropDownList  ID="EmpDept" runat="server" Height="27px" Width="296px"  Font-Size="Medium">
                      <asp:ListItem Value="0">- Please Select</asp:ListItem></asp:DropDownList>

    vb.net code:

     Using sqlCmd As New SqlCommand()
                    sqlCmd.CommandText = "SELECT dept FROM Department"
                    sqlCmd.Connection = sqlConn
                    Dim da As New SqlDataAdapter(sqlCmd)
                    Dim dt As New DataTable()               

                    EmpDept.DataSource = dt

                    EmpDept.DataTextField = "dept "
                    EmpDept.DataValueField = "dept "


    how to solve this issue

    Friday, September 18, 2020 8:23 PM

All replies

  • User-939850651 posted

    Hi kafsar,

    how to solve this issue

    According to the code you provided, you seem to have queried data from the database and bound the data source to the drop-down list control. What does your issue mean? Is the value displayed by the drop-down option different from the record in the database? Or something else?

    And I'm not sure if its options have been modified elsewhere in the program. If possible, could you describe the issue you encountered and the results you expect more clearly?

    Best regards,

    Xudong Peng

    Monday, September 21, 2020 5:43 AM