Re: dropdown SelectedValue

  •  07-25-2006, 5:25 AM

    Re: dropdown SelectedValue

    Thank you.
     
    Your suggestion worked. I don't know why I assumed I needed to use a RichDropDownList.
     
    Anyway, this is the code that I am now using, which works:
     
      Dim container As System.Web.UI.Control
        container = Editor1.ToolControls("custom").Control
        Dim ddlTemplates As DropDownList
        ddlTemplates = New DropDownList
        ddlTemplates.CssClass = "~/styles/AcmsMain.css"
        ddlTemplates.ToolTip = "Select Template"
        container.Controls.Add(ddlTemplates)
        Dim objRdr As SqlClient.SqlDataReader = Nothing
        objRdr = SiteDB.SiteGetTemplatesByPage(PageID, NewPage)
        If Not Page.IsPostBack Then
          Try
            ddlTemplates.DataTextField = "Name"
            ddlTemplates.DataValueField = "TemplateID"
            ddlTemplates.DataSource = objRdr
            ddlTemplates.DataBind()
            'ddlTemplates.Items.Insert(0, New ListItem("Template", ""))
            ddlTemplates.SelectedValue = ViewState("TemplateID")
          Finally
            objRdr.Close()
          End Try
        End If
View Complete Thread