We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dialog load URL and ReturnValue


Hello, I have some questions related to the Dialog. How can its content to be loaded when you open it /when click the button that opens dialog/ , not when the page loads? I want content that opens the dialog to be a URL to a page on my website.
How to get from the loaded page /shown in the dialog/ return value?

7 Replies

FP Francis Paul Antony Raj Syncfusion Team February 11, 2016 01:30 PM UTC

Hi Emil,


Thanks for contacting Syncfusion support.


We have analyzed your query. You can load the dialog content while open the dialog using our existing ejDialog property “ContentType” by setting its value as ajax and along with setting the desired url in “ContentUrl” property. Please refer the following code snippet.

@Html.EJ().Dialog("dialog").Title("Dialog").ContentType("ajax").ContentUrl("Home/Dialog").ShowOnInit(false).IsResponsive(true).ClientSideEvents(evt => evt.Close("onDialogClose"))

For your convenience, we have attached the sample to show case this. Please get the sample from the below location.

http://www.syncfusion.com/downloads/support/directtrac/general/ze/dialog1297913412

In this sample we have also showcased the data retrieving from dialog in controller section.

To know more about dialog properties, methods and events, please refer to,

http://help.syncfusion.com/js/api/ejdialog

To know about how to load the ajax content in dialog, please refer to,

http://help.syncfusion.com/aspnetmvc/dialog/load-content

Please let us know, if you need any further assistance.


Regards,

Francis Paul A



EY Emil Yotov February 11, 2016 02:36 PM UTC

Hi, in your example everything is OK, but copy the sample code in my project dialog opens in page load and URL link does not open page - just dialog shows progress.
I do not know what exactly is the problem. It may be _Layout.cshtml. Here are the declarations of HEAD:


<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ovelon CRM</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    @*mobile components CSS styles reference*@
    <link rel='nofollow' href="@Url.Content("~/Content/ej/web/Default-theme/ej.widgets.all.min.css")" rel="stylesheet" />


    <script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.easing.1.3.min.js")"></script>

    @*web & mobile components script reference*@
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>

    <script src="@Url.Content("~/Scripts/ej/cultures/ej.culture.en-US.min.js")"></script
</head>



Below have the following code /after RenderBody/

@Html.EJ().ScriptManager()
                @RenderSection("scripts", required: false)
                <script type="text/javascript">
                    //To prevent input controls auto initialization, we need to set this property
                    App.renderEJMControlsByDef = false;
                    //To prevent the initialization of AppView, we need to set this property
                    App.preventAppviewInit = false;
                    $(function () {
                        $('#page').css("min-height", $(document).height());
                    });

                </script>


FP Francis Paul Antony Raj Syncfusion Team February 12, 2016 03:02 PM UTC

Hi Emil,


Sorry for the inconvenience.


We have analyzed your query. We suspect that ContentUrl with improper format leads to the incorrect navigation of page which causes your reported issue. If we give ContentUrl like “Home/Dialog” and sets the http://localhost:63279/Home/index as startup page, then ContentUrl mapped from its parent controller and set as http://localhost:63279/Home/Home/Dialog which is invalid.

To resolve this please make sure to give the “ContentUrl” started with “/”, else provide the url as Url.Action(“view”, “controller”). If we set url as “/Home/Dialog”, then it gets mapped as http://localhost:63279/Home/Dialog and which is valid.


Please refer the following code snippet


@Html.EJ().Dialog("dialog").Title("Dialog").ContentType("ajax").ContentUrl("/Home/Dialog").ShowOnInit(false).IsResponsive(true).ClientSideEvents(evt => evt.Close("onDialogClose"))  

                                        (or)

@Html.EJ().Dialog("dialog").Title("Dialog").ContentType("ajax").ContentUrl(Url.Action("Dialog", "Home")).ShowOnInit(false).IsResponsive(true).ClientSideEvents(evt => evt.Close("onDialogClose"))

Please check with the given solution. If still you are facing any difficulties, please provide more information about your issue. We will be happy to help you.


Regards,

Francis Paul A



EY Emil Yotov February 15, 2016 03:50 PM UTC

Is there a way to charge the Dialog view , not just a partial view. If not, how can I use components Syncfusion in open Dialog? In partial view not load HEAD declarations.

Thank You


FP Francis Paul Antony Raj Syncfusion Team February 17, 2016 03:40 AM UTC

Hi Emil,


We have analyzed your query. You can use our components inside ejDialog, when the ejDialog content loaded through ajax request. Please check with the following solution.


Please ensure that whether the unobtrusive mode in web.config file is true or false.


#1) If unobtrusive mode is true (“<add key="UnobtrusiveJavaScriptEnabled" value="true" />”), then please refer the “unobtrusive.min.js” file in “_Layout” Page and you need to trigger the “ej.widget.init()” function before the dialog content opens using “beforeopen” event of dialog.

#2) If unobtrusive mode is false (“<add key="UnobtrusiveJavaScriptEnabled" value="false" />”), then please use “@Html.EJ().ScriptManager() at the end of partial view (“Dialog”) Page


For your convenience, we have attached the sample in the below location.

http://www.syncfusion.com/downloads/support/forum/121938/ze/Dialog-1108542379

Please check with the given solution and let us know, if you need any further assistance.


Regards,

Francis Paul A



EY Emil Yotov February 17, 2016 10:14 AM UTC

Thank You, Francis.


FP Francis Paul Antony Raj Syncfusion Team February 18, 2016 12:59 PM UTC

Hi Emil,


Thanks for your update.

We hope that your problem has been resolved now. Kindly get back to us if you need any further assistance.


Regards,

Francis Paul A


Loader.
Up arrow icon