WebUser Control Updating Parent Page

53 views Asked by At

I have a page where a user will input some values. There is a Label which holds values for options (i.e. Timezone). User clicks on the linkbutton and a Web User Control displays via AJAX ModalPopupExtender.

<cc1:ModalPopupExtender ID="mpeOptions" runat="server" TargetControlID="lbError" DropShadow="True" CancelControlID="Options1$lbCancelHelp" OkControlID="Options1$butOK" PopupControlID="pnlOptions" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlOptions" runat="server" CssClass="GridView" Width="400px">
    <oc1:Options ID="Options1" runat="Server" />        
</asp:Panel>    

User makes their choice in the popup. Clicks OK and the popup closes. However the Label doesn't update with the user's selection. It only updates if you click on Options again.

I added a PostCallback in the butOK on the popup:

ScriptManager sm = ScriptManager.GetCurrent(Page);
        if (sm != null)
            sm.RegisterAsyncPostBackControl(butOK);

And in the Form Load added:

lblTimezone.Text = "Timezone: " + Options1.TimeZone.SelectedItem.Text;
0

There are 0 answers