Adding an attribute to related Radcombobox

4 posts, 0 answers
  1. Shahid
    Shahid avatar
    12 posts
    Member since:
    May 2009

    Posted 08 Oct 2010 Link to this post

    Hi,

    We use related combos similar to the way it has been shown at the following link.
    http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

    We also have RadAjaxManager present on each page.

    Now, I initiate javascript call "myCombo.requestItems(text, null)" . This performs perfectly and provide me updated combo.

    But part from above process , my other requirement is setting up a hidden field on server side inside myCombo_ItemsRequested(object o , eventargs e) {}. For this I have tried,

    1) setting hidden field directly , but when I check its value in javascript function OnClientsideItemsRequested() of same myCombo, then the value is not updated with server change. I also have this hidden field as updated control items of myCombo in
    Rad ajax manager.

    2) Thinking that this request will only update myCombo and not any other fields / controls. Instead of updating hidden field , I added an attribute to mycombo on server side and then check that attribute on client side. But I was also not able to fetch that attribute too on client side.

    Function initiated from : myCombo.requestItems(text, null);
    Server side function : myCombo_ItemsRequested(...)
    Client side function: myComboOnItemsRequested(...)

    Please suggest a way by which I can process any field or same combo in server side and use the updated value on client side.

    Let me know if any other info is required.,

    Thanks
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 12 Oct 2010 Link to this post

    Hello Shahid,

    Yes, RadComboBox Item requests update only the RCB with info about the newly loaded Items, so setting an attribute to the control will not work as well.

    Fortunately you can use the 'show more results' message to transfer the needed information back to the client. You can set the ShowMoreResults property in the ItemsRequested event handler in the event arguments and later get in the client-side ItemsRequested event again from the event arguments. All of this is easy if you are not using the 'Show More Results' functionality. If you do however, you can set the attribute to the first returned Item and extract it from it on the client.

    I hope this helps.

    Greetings,
    Simon
    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
  3. Shahid
    Shahid avatar
    12 posts
    Member since:
    May 2009

    Posted 19 Oct 2010 Link to this post

    Thanks Simon for your reply,

    I have tried using ShowMoreResultBox property of the combobox for passing a boolean balue from server side to client side, although its not working for me.

    In the server side combo_ItemRequested(Object o, RadComboBoxItemRequestedEventArgs e)
    {
    combo.ShowMoreResultsBox = true;
    }

    Then on Client side JavaScript function OnClientItemRequested(combo, eventArgs)
    {
    var bMoreResult = combo._showMoreResultBox;
    }

    Client side bMoreResult does not have the true value which was set on server side. Please let me know if I am doint it correctly ?
    If possible please forward me any link which describes how to set and retrive the value using showMoreResultBox.

    Thanks

  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 25 Oct 2010 Link to this post

    Hi Shahid,

    Please excuse me for misleading you. The property is named Message (e.Message) and it is of type string.

    Then in the client-side ItemsRequesting event handler you can access and use the message:
    function onItemsRequested(sender, eventArgs) {
        alert(sender.get_showMoreMessage());
    }

    I hope this helps.

    Greetings,
    Simon
    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