RadWindow And ComboBox Interaction

4 posts, 0 answers
  1. Xcalibur
    Xcalibur avatar
    11 posts
    Member since:
    Jul 2007

    Posted 06 Aug 2008 Link to this post

    My scenario:

    I have a main page with a combo box in it that displays a list of customer names.  Under that are 2 buttons to "add" a new customer or "edit" the currently selected customer.  Now when the "add" button is clicked the server side Click event opens a RadWindow with a DetailsView in it that then allows me to specify the new customer's details.  Similarly, the edit button opens the same RadWindow/DetailsView but in edit mode.  In addition to the DetailsView are 2 buttons "OK" and "Cancel".  Since i am using buttons outside the DetailsView i am actually calling the DetailsView to Update/Insert from the server side event of the buttons in the RadWindow.

    What i am having an issue with is updating the combo box when the RadWindow closes.  When i edit a customer, potentially the name changes so i need to update the combo box.  Also when i add a new customer i need to add the new name to the combo box.  In addition, i need the newly added customer to be selected.  Of course this will be ajaxified as i dont want the entire main page to update.

    Now i have been doing a lot of searching and found related posts, such as opening an add/edit window from a grid, etc but after a lot of playing i have not found a solution that meets all the above criteria.  Rather than 'taint' the answer i am given with what i have tried, can you please tell me the most efficient and recommended approach to solving this scenario, specifically:

    1) The best way to close the RadWindow and return
    2) The best way to update the ComboBox (Rebind and Refresh)
    3) The best way to select the entry in the ComboBox that was edited/added

    thank you very much in advance for any assistance you can give.  Example code is always welcome :oI
  2. Xcalibur
    Xcalibur avatar
    11 posts
    Member since:
    Jul 2007

    Posted 06 Aug 2008 Link to this post

    Oh one more important thing i forgot to add is how to cancel the window closing if validation fails on the DetailsView fields.  I have RequiredFieldValidators on many of the fields.

    UPDATE: Forget this part of the question as I found a solution to this.  For those that are interested look HERE
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Xcalibur
    Xcalibur avatar
    11 posts
    Member since:
    Jul 2007

    Posted 08 Aug 2008 Link to this post

    I dont want to rush but its been a while and i need this working by Monday!  Is anyone at Telerik able to help me with this, i would greatly appreciate it.
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 08 Aug 2008 Link to this post

    Hello Xcalibur,


    Up to your questions:
    1. To close a RadWindow from within the content page, you need to get a reference to the window by using the GetRadWindow() function and then call its close() method. Depending on your scenario, you can return an argument from the content to the parent page by using either OnClientClose or the ClientCallBackFunction eventhandlers. More information on the subject and code sample is available in the documentation, section RadControls/RadWindow/Programming/Using RadWindow As A Dialog (online version).
    2. RadComboBox does not have internal rebind / refresh so when closing the window you should either update your database and call DataBind() for the combobox or as an alternative - add the new item to the already loaded ones. More information on the subject is available in the documentation and in the following demos:
      http://www.telerik.com/demos/aspnet/prometheus/ComboBox/Examples/Programming/AddRemoveDisableItemsClientSide/DefaultCS.aspx
      http://www.telerik.com/demos/aspnet/prometheus/ComboBox/Examples/Programming/AddRemoveDisable/DefaultCS.aspx
    3. You can do this by using FindItemByText or FindItemByValue client-side methods:
      RadComboBox1.FinfItemByText("Item_text")
      RadComboBox1.FindItemByValue("Item_value")

    I hope this helps. Please note that although we monitor closely the forums, we do not guarantee a timely response here as they are consider a community resource. If you need a guaranteed response on time, I strongly recommend to use the support ticketing system where you will be answered in the timeframe set in your support package.



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top