I have a RadComboBox that displays a list of appropriate addresses to ship to from the user's address book. When choosing which address to ship to they select from this dropdown. However, they want the ability to edit their address book without having to leave the Order Form. I solved this with an additional button that opens in a RadWindow the same page they use to edit their address book from their profile. They can add, change, search for addresses easily from this window. When they close the window however the changes are not reflected in the RadComboBox.
I am using Ajax on the page already and it is a form so if I allow the page to postback it can sometimes lose some of the information that was in the form if the user changed it.
Is there a way that I can rebind the RadComboBox to fetch the latest information similar to how the RadGrid can rebind?
Javascript:
<script type=
"text/javascript"
>
function
ShowAddressBook(button, args) {
if
(!confirm(
'This action will redirect you to your Address Book. You will lose all unsaved information. Are you sure?'
)) {
return
false
;
}
else
{
$find(
"<%=AddressBookWindow.ClientID %>"
).show();
}
}
function
RefreshAddresses() {
location.reload();
}
</script>
ASPX
<
telerik:RadComboBox
runat
=
"server"
ID
=
"rcbAddress"
Width
=
"200px"
EnableItemCaching
=
"false"
EnableLoadOnDemand
=
"true"
DataSourceID
=
"dsAddressBook"
DropDownWidth
=
"250px"
HighlightTemplatedItems
=
"true"
EmptyMessage
=
"Select Address"
DataTextField
=
"AddressName"
DataValueField
=
"AddressID"
>
<
ItemTemplate
>
<
div
class
=
"boxitem"
>
<
div
class
=
"addressLabel"
><%# DataBinder.Eval(Container.DataItem, "AddressName") %></
div
>
<
div
class
=
"boxdetail"
>
<
div
class='<%# DataBinder.Eval(Container.DataItem, "AddressTypeClass") %>'> </
div
>
<
div
class
=
"addressFormat"
>
<
strong
><%# DataBinder.Eval(Container.DataItem, "RecipiantName") %></
strong
><
br
/>
<%# DataBinder.Eval(Container.DataItem, "Address1") %><
br
/>
<%# DataBinder.Eval(Container.DataItem, "Address2") %><
br
/>
<%# DataBinder.Eval(Container.DataItem, "City") %>, <%# DataBinder.Eval(Container.DataItem, "State") %> <%# DataBinder.Eval(Container.DataItem, "ZIP") %>
<%# DataBinder.Eval(Container.DataItem, "Country") %>
</
div
>
</
div
>
</
div
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
<
telerik:RadButton
ID
=
"btnShowAddressBook"
CausesValidation
=
"false"
AutoPostBack
=
"false"
runat
=
"server"
OnClientClicked
=
"ShowAddressBook"
Text
=
"Edit Address Book"
>
<
Icon
PrimaryIconCssClass
=
"rbOpen"
PrimaryIconLeft
=
"4"
PrimaryIconTop
=
"4"
/>
</
telerik:RadButton
>
---
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"AddressBookWindow"
Modal
=
"true"
VisibleStatusbar
=
"false"
OnClientClose
=
"RefreshAddresses"
Title
=
"Manage Address Book"
NavigateUrl
=
"/SiteControls/AddressBook.aspx"
runat
=
"server"
AutoSize
=
"true"
style
=
"z-index:8000;"
/>
</
Windows
>
</
telerik:RadWindowManager
>