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

How to close an edit form popup?

1 Answer 254 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 1
Bruce asked on 03 Jan 2014, 10:25 PM
I have a grid where I popup a modal user control to enter / view payment information. There is one button that when clicked opens another web site in a RadWindow. When this button is clicked I want to show the radwindow and close the edit form. I can show the window okay, but I cannot figure out how to close the edit window from within the user control.
<telerik:RadGrid ID="uxPaymentsGrid" runat="server"
                           AutoGenerateColumns="false"
                           AllowMultiRowSelection="false"
                           OnNeedDataSource="uxPaymentsGrid_NeedDataSource"
                           OnCustomAggregate="uxPaymentsGrid_CustomAggregate"
                           OnItemDataBound="uxPaymentsGrid_ItemDataBound"
                           OnSelectedIndexChanged="uxPaymentsGrid_SelectedIndexChanged"
                           OnDeleteCommand="uxPaymentsGrid_DeleteCommand"
                           OnUpdateCommand="uxPaymentsGrid_UpdateCommand">
                           <MasterTableView ShowFooter="true" DataKeyNames="PaymentId" EditMode="PopUp">
                               <Columns>
                                   <telerik:GridBoundColumn DataField="PaymentId" DataType="System.Guid" HeaderText="PaymentId" Display="false"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="Amount" DataType="System.Decimal" HeaderText="Amount" DataFormatString="{0:C}" Aggregate="Custom" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="PaymentType" DataType="System.String" HeaderText="Type" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridCheckBoxColumn DataField="Deductible" DataType="System.Boolean" HeaderText="Ded" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" Display="true"></telerik:GridCheckBoxColumn>
                                   <telerik:GridBoundColumn DataField="License" DataType="System.String" HeaderText="License" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="DOB" DataType="System.DateTime" HeaderText="DOB" DataFormatString="{0:d}" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="PartialAccount" DataType="System.String" HeaderText="Account" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="DExpires" DataType="System.Int32" HeaderText="Expires" DataFormatString="{0:M/yyyy}" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="ApprovalCode" DataType="System.String" HeaderText="App. Code" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="DTransactionId" DataType="System.String" HeaderText="Trans ID" Display="true"></telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="PaymentDate" DataType="System.DateTime" HeaderText="Paid" DataFormatString="{0:MM/dd/yyyy}" Display="true"></telerik:GridBoundColumn>
                               </Columns>
                               <EditFormSettings EditFormType="WebUserControl" UserControlName="PaymentControl.ascx">
                                   <PopUpSettings Modal="true" Width="640px" />
                               </EditFormSettings>
                               ...

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Jan 2014, 07:53 AM
Hi Bruce,

I guess you have a button inside the UserControl form to open a RadWindow. You can close the edit Popup form from the RadGrid ItemCommand event from the ASPX page. Using the Button's CommandName you can access it in ItemCommand event. Here is a small sample i tried:

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow ID="window1" runat="server">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "Window")
    {
        e.Item.OwnerTableView.OwnerGrid.EditIndexes.Clear();
        e.Item.OwnerTableView.OwnerGrid.Rebind();
        window1.NavigateUrl = "http://www.google.com";
        window1.VisibleOnPageLoad = true;
        window1.ID = "RadWindow1";
        window1.Width = 500;
        window1.Height = 300;      
    }
}

ASCX:
<asp:Button ID="Button1" runat="server" Text="Open Window" CommandName="Window" />

Thanks,
Princy
Tags
Grid
Asked by
Bruce
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or