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

Create Dialog in Server-Side

Hi

My question is how can i create a control from the server-side, especially a Dialog control; or maybe create the Control in the client-side and then execute it in the server-side.

Example.cshtml:

@{Html.EJ().Dialog("basicDialog").Title("Basic").ContentTemplate(@<div>Message</div>));}

ExampleController.cs:

if("something"){
(basicDialog,Show)
}

Thank you so much for your help

Regards.

3 Replies

KC Kasithangam C Syncfusion Team June 1, 2015 01:08 PM UTC

Hi Julio,

We have achieved your requirement “create the Control in the client-side and then execute it in the server-side (show dialog)” and please find the sample under the following location,


Sample: Sample


In this above sample, we have created the wrapper for dialog control in view page and set the property “showOnInit” as false via codebehind.Initially it doesn’t shows the dialog.Please find the wrapper code,


<code>


@{Html.EJ().Dialog("basicDialog",Model).Render();}


</code>


In the button click event, we have enabled this property in the controller as shown below code.Now the dialog control get displays.

 

<code>


public ActionResult Index(string basicDialog)

        {

            Syncfusion.JavaScript.Models.DialogProperties dia = new Syncfusion.JavaScript.Models.DialogProperties();

            dia.ShowOnInit = true;

            return View(dia);

        }

</code>


Please let us know if you have any further assistance,

Regards,

Kasithangam



JU Julio June 2, 2015 04:50 PM UTC

Hi, thank you for your replay, it is working very well. But now I would like to know how can i set the content proprieties. I am thinking with the "ContentTemplate " propriety:

Syncfusion.JavaScript.Models.DialogProperties dia = new Syncfusion.JavaScript.Models.DialogProperties();
dia.ShowOnInit = true;
dia.Title = "Mensaje";
dia.ContentTemplate = ???
return View(dia);

Regards. 


KC Kasithangam C Syncfusion Team June 3, 2015 12:27 PM UTC

Hi Julio,


Thanks for your update.


We need to set the contentTemplate property in controller page as shown below code,


<code>

Syncfusion.JavaScript.Models.DialogProperties dia = new Syncfusion.JavaScript.Models.DialogProperties();

            dia.ShowOnInit = true;

            dia.ContentTemplate = new MvcTemplate<object>

            {

                RazorViewTemplate = (data) =>

                {

                    return "<div>Message</div>";

                }

            };

            return View(dia);

</code>


Also we have modified the sample based on this and please find the sample under the following location,


Sample: Sample


Please let us know if you have any further assistance,

Regards,

Kasithangam


Loader.
Live Chat Icon For mobile
Up arrow icon