This is a migrated thread and some comments may be shown as answers.

RadWindow And ComboBox Interaction

3 Answers 109 Views
Window
This is a migrated thread and some comments may be shown as answers.
Xcalibur
Top achievements
Rank 1
Xcalibur asked on 06 Aug 2008, 04:35 PM
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

3 Answers, 1 is accepted

Sort by
0
Xcalibur
Top achievements
Rank 1
answered on 07 Aug 2008, 02:07 AM
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
0
Xcalibur
Top achievements
Rank 1
answered on 08 Aug 2008, 09:11 AM
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.
0
Georgi Tunev
Telerik team
answered on 08 Aug 2008, 11:30 AM
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.
Tags
Window
Asked by
Xcalibur
Top achievements
Rank 1
Answers by
Xcalibur
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or