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

How to open EditorTemplate from a button click inside another EditorTemplate

2 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 17 Jun 2015, 03:06 PM

I am trying to open an paymentEditor.cshtml from subscriberEditor.cshtml. SubscriberEditor is a popup form when a new record or update record clicked on a grid.

This is my code.

 

SubscriberEditor:

<table>
                    <tbody>
                        <tr>
                            <td>
                                <script>
                                    $('#MakePayment').click(function () {
                                        var left = ($(window).width() / 2) - (600 / 2),
                                        top = ($(window).height() / 2) - (300 / 2),
                                        popup = window.open("~/PaymentEditor.cshtml", "MakePaymentPopup", "width=600, height=300, top=" + top + ", left=" + left);
                                        return popup;
                                    });
                                </script>  
                                @(Html.Kendo().Button()
                                    .Name("MakePayment")
                                    .HtmlAttributes( new {type = "button"} )                                                                                                                                               
                                    .Content("Make A Payment")
                                )
                            </td>
                        </tr>
                    </tbody>   

 

Can anyone can tell me why isn't this working?

2 Answers, 1 is accepted

Sort by
0
Victor
Top achievements
Rank 1
answered on 17 Jun 2015, 03:20 PM

<button id="open" class="k-button">Make A Payment</button>                                
                                <div id="window"></div>
                                <script>
                                    $("#open").click(function (e) {
                                        var window = $("#window");
                                        window.kendoWindow({
                                            width: "505px",
                                            height: "315px",
                                            title: "Make a payment",
                                            actions: ["Pin", "Refresh", "Maximize", "Close"],
                                            content: "~/PaymentEditor.cshtml"
                                        });

                                        window.data("kendoWindow").open();
                                        window.data("kendoWindow").center();
                                    });                                        
                                </script>

 

I tried this but the page refreshes and closes all both windows. Can anyone help me ?

0
Boyan Dimitrov
Telerik team
answered on 19 Jun 2015, 02:37 PM

Hello Victor,

I prepared a sample project that implements the described scenario. Could you please try to replicate the issue and send it back to us for further investigation? 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Victor
Top achievements
Rank 1
Answers by
Victor
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or