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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Why is not the dropdownlist rendered in a partialview?

Thread ID:

Created:

Updated:

Platform:

Replies:

143182 Mar 7,2019 10:32 PM UTC Mar 11,2019 08:53 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: DropDownList
Juan Antonio
Asked On March 7, 2019 10:32 PM UTC

|I'm trying to create a form with a dropdownlist in a partial view, but when I run my application, only one textbox appears. I did tests with a grid, with a button and with a dialog and there is no problem.
here is my code
@(
                    Html.EJS().DropDownList("Album")
                    .DataSource(dataManager => dataManager.Url(Url.Action("Albums", "JS2", null, Request.Url.Scheme)).Adaptor("UrlAdaptor").CrossDomain(true))
                    .Placeholder("Selecciona")
                    .PopupHeight("200px")
                    .Fields(new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings
                    {
                        Value = "AlbumId",
                        Text = "Titulo"/*, Id="AlbumId"*/
                    })
                    .ActionComplete("complete").ActionFailure("fail").Change("onSelect")
                    .Render()
    )

public ActionResult GetArtista(Syncfusion.EJ2.Base.DataManagerRequest dm)
        {
            var data = read.GetArtistas();

            return Json(data);
        }

I have another question: Can @Ajax.BeginForm be used with Syncfusion controls?
I hope you can help me. I thank you very much

Prince Oliver [Syncfusion]
Replied On March 8, 2019 11:58 AM UTC

Hi Juan, 

Thank you for contacting Syncfusion support. 

Query 1: I'm trying to create a form with a dropdownlist in a partial view, but when I run my application, only one textbox appears. 

We have checked your scenario and shared code snippet. We suspect that you might have missed to bind events to the DropDownList component but have initialized your script. This could have caused script error in the application and the control is not rendered. Kindly ensure whether all the events have their respective JavaScript handler functions. 

@( 
    Html.EJS().DropDownList("Album") 
    .DataSource(dataManager => dataManager.Url(Url.Action("Albums", "JS2", null, Request.Url.Scheme)).Adaptor("UrlAdaptor").CrossDomain(true)) 
    .Placeholder("Selecciona") 
    .PopupHeight("200px") 
    .Fields(new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings 
    { 
        Value = "AlbumId", 
        Text = "Titulo"/*, Id="AlbumId"*/ 
    }) 
    .ActionComplete("complete").ActionFailure("fail").Change("onSelect") 
    .Render() 
) 
 

 Also, please add “@Html.EJS().ScriptManager()”  at the end of the partial view page. We have prepared sample based on your scenario. Kindly refer to the following code snippet. 

[main page] 
<div class="col-lg-12 control-section" style="margin: 50px"> 
    <div id="wrapper"> 
    </div> 
</div> 
<button id="datebutton" text="Click" onclick="onClick()"> click Partial view </button> 
<script type="text/javascript"> 
    function onClick() { 
        var ajax = new ej.base.Ajax('/Home/PartialView1/?Person2', 'GET', true); 
        ajax.send().then(); 
        ajax.onSuccess = function (data) { 
            $("#wrapper").html(data); 
        } 
    } 
</script> 
 

[partial view page] 
<div id="Myfrom" style="width:300px"> 
 
@(Html.EJS().DropDownList("Album").DataSource((IEnumerable<object>)ViewBag.data) 
 
    .Placeholder("Selecciona").PopupHeight("200px").Render() 
 
) 
 
@Html.EJS().ScriptManager() 
 

We have attached a sample for your reference, please find the sample at the following location. 

Query 2: Can @Ajax.BeginForm be used with Syncfusion controls? 

Yes, you can use Ajax.BeginForm with Syncfusion controls. 

Please let us know if you need any further assistance on this. 

Regards, 
Prince 


Juan Antonio
Replied On March 8, 2019 09:21 PM UTC

I appreciate that you have answered my two questions. I would like to know if you can put Syncfusion controls (like dropdownlist, datepicker, etc) into a dialog control to create a form

Prince Oliver [Syncfusion]
Replied On March 11, 2019 08:53 AM UTC

Hi Juan, 
 
Thank you for your update. 
 
Yes, you can put Syncfusion controls (like dropdownlist, datepicker, etc) into a dialog control to create a form. We have prepared simple sample for Dialog component with partial page content. We have covered below things on the sample. 
 
  • We have rendered Dialog component and hide on initial rendering using visible property.
  • We have got partial view page content using ajax post and append into Dialog content element before open the dialog component using BeforeOpen event.
 
 
Kindly refer to the following links for further reference. 
 
Online Demo sample for loading AJAX content: https://ej2.syncfusion.com/aspnetmvc/Dialog/AjaxContent#/material  
 
Please let us know if you need any further assistance on this.  
 
Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;