Postbacks

3 posts, 0 answers
  1. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 26 Jul 2013 Link to this post

    I am new to the telerik controls so pardon my ignorance.

    I have an AutoComplete box bound in code behind to an list.  

    When the webform loads I set the data souce. When i type a letter into the autocomplete box the form posts backs. 

    This is my  code:

            If Not IsPostBack Then
                RadAutoCompleteBox1.DataSource = App.Clients.Items.Values.ToArray
                RadAutoCompleteBox1.DataBind()
            End If

    If I remove it from the if condition the box works but the page posts back every key press. Is this how its supposed to work?

    If so my problem, is this. I have a radcombobox and when a user selects an item, using AJAX and client side, the datasource of the autocomplete changes based on the selection in the radcombo.

    However when the user type a character the entire page posts back and i get the following error.

    "The Control DataSource(or DataSourceID) is not set"

    What i figured out is when the page posts back the autocomplete no longer has a binding and throws the error.

    I had this working using two combo boxes but i wanted to us the autocomplete in place of the second combo.

    Intuitively this does not work like i would think it should. am i doing something wrong here?



  2. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 26 Jul 2013 Link to this post



    I guess my issue isn't the postback, but why do the combos remember their binding but the autocomplete does not. I would think they should work the same. As a rule i put my code in and "If IsPostBack" block or my chained combos get wiped out. 

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 29 Jul 2013 Link to this post

    Hello Kim,

    The DataSource of the RadAutoCompleteBox should be supplied regardless if a PostBack occurs or not. The binding mechanism of the control, relies on the currently type character ( where a callback occurs ) upon which the control is populated. Each time a character is typed, a callback is initiated in order to performed the query to the used datasource. Here you could find our help article, demonstrating the data biding to a various datasources and here is our online demo on the matter.

    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top