Processing combo-box selections on client

6 posts, 0 answers
  1. Oleg Slyusarchuk
    Oleg Slyusarchuk avatar
    7 posts
    Member since:
    Jun 2004

    Posted 29 Jan 2010 Link to this post

    Requirements

    RadControls version  

     

    RadControls for ASP.NET AJAX Q3 2009 SP2.NET version

    3.5

    Visual Studio version

    2008

    programming language

     

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    I need to process combobox-selections doing this client-side on a page postback;

    Essentially, I need to show  selections followed by "X". Clicking on the "X" should uncheck corresponding value in my combo.
    (see attached image)
    Everything works fine until I click "Apply selections" to initiate postback.
    When page loads, I see that combobox keeps selections (using ViewState).

    What is a correct way to  hook an event that shoud run after combo renders ?

    I tried;
    - body onload="process())
    - placing script at the bottom of the page
    - using JScript  $(document).ready(function()
    - Page.ClientScript.RegisterStartupScript server-side

    In all the instances, when my javascript executes:

    var

     

    combo = $find(comboBoxId);

     

    I'm getting null for combo.

    I suspect that I should use ScriptManager.
    Is it a known issue? What would you suggest ?

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 09 Feb 2010 Link to this post

    Hello Oleg Slyusarchuk,

    You can use either of the following, which exactly fit your case:
    • Define the pageLoad function on your page. In it, $find will return the client-side object of RadComboBox correctly.
    • Handle the client-side Load event of the RadComboBox:
      function onLoad(sender) {
          // sender == comboBox;
      }

    Sincerely yours,
    Simon
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Oleg Slyusarchuk
    Oleg Slyusarchuk avatar
    7 posts
    Member since:
    Jun 2004

    Posted 12 Feb 2010 Link to this post

    Simply adding
    function onLoad(sender) {
        // sender == comboBox;
    }


    to the page did not do the trick.
    This event never fired.
    Should I explictly register this function ?
  4. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Feb 2010 Link to this post

    Hello Oleg,

    You should handle OnClientLoad event of the combobox as it's demonstrated here.

    Best wishes,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Oleg Slyusarchuk
    Oleg Slyusarchuk avatar
    7 posts
    Member since:
    Jun 2004

    Posted 18 Feb 2010 Link to this post

    I have 12 Telerik controls on on my page.
    6 of them - combo-boxes that represent filtering for the  6 - RadGrid controls that are being  created dynamically (onInit, server-side) based on the selection combos' selections. All the complex combos interactions are being handled client-side.
    Which of the controls has to have this event (onLoad) registered?
    Is there any page-level event handler similar to body's onload?

  6. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 23 Feb 2010 Link to this post

    Hello Oleg,

    You can use pageLoad() javascript event which is  page-level and not related to the comboboxes, I also suggest you use Telerik.Web.UI.RadComboBox.ComboBoxes which returns an array containing all the
    combobox instances on the page.

    Best regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top