RadComboBox from code-behind not declared?

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    335 posts
    Member since:
    Feb 2007

    Posted 15 Feb 2010 Link to this post


    I have the following problem. I create RadComboBox in code-behind Page_init

    Dim ddl As RadComboBox 
    Dim sqlSource As SqlDataSource 
    ddl = New RadComboBox 
    sqlSource = New SqlDataSource 
    sqlSource.ConnectionString = WebConfigurationManager.ConnectionStrings(TablePrefix).ConnectionString 
    sqlSource.SelectCommand = " SELECT ValueText, " & UItaal & "text AS tekst FROM " & TablePrefix & "_" & ArrCategory & " " 
    ddl.DataSource = sqlSource 
    ddl.ID = "ddl_BU" 
    ddl.EmptyMessage = GetGlobalResourceObject("Insight", "Maak uw selectie") 
    ddl.DataValueField = "ValueText" 
    ddl.DataTextField = "tekst" 
    The ComboBox is created OK but I cannot find it with

    Dim ddl As RadComboBox = Page.FindControl("ddl_BU") 

    It's keep telling me

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Why isn't the control added to the Controls collection?


  2. Fit2Page
    Fit2Page avatar
    335 posts
    Member since:
    Feb 2007

    Posted 16 Feb 2010 Link to this post

    OK this is working now, I did find the control with:

    Dim ddl As RadComboBox = plh_Category.FindControl("ddl_BU")  
    Thanks for yr time


  3. Telerik UI for ASP.NET Core is out
Back to Top