none
Value in Dropdown menu

    Question

  • how to make value selected in dropdown menu from backend as value coming from database

    in asp.net  

    <asp:DropDownList ID="DropDownListTemplate" runat="server">
                         <asp:ListItem Selected="True" Value="-1"> Select Category </asp:ListItem>
                         <asp:ListItem  Value="Clients">Clients</asp:ListItem>
                         <asp:ListItem  Value="Industry">Industry</asp:ListItem>
                 </asp:DropDownList>

    in vb.net

    Dim id As Integer = Convert.ToInt32(Request.QueryString("ID"))

                ProjectsSectionId.Value = id
                Dim ds As DataSet = CMSProjectSection.GetProjectsById(id)
                txbProjectTitle.Text = ds.Tables(0).Rows(0).Item(1)
      
                DropDownListTemplate.SelectedValue = ds.Tables(0).Rows(0).Item(2)

                txbProjectContent.Text = ds.Tables(0).Rows(0).Item(3)

    above code is now showing selected value "client"

    Plz check my code n help n thnxx

    Tuesday, June 26, 2012 11:27 AM

Answers

  •          DropDownListTemplate.text = ds.Tables(0).Rows(0).Item(2)

    above code works

    • Marked as answer by SSmadhu Thursday, June 28, 2012 8:10 AM
    Thursday, June 28, 2012 8:10 AM