- Home
- Forum
- ASP.NET MVC
- Grid and other controls do not appear in PartialView
Grid and other controls do not appear in PartialView
Hello!
Why are the controls not rendered within PartialView?
When my application calls a PartialView, the grid is not rendered and the DatePicker control is not rendered correctly in this PartialView.
The PartialView is called like this: $('#contents').load("@Url.Action("DashboardIndex","Dashboard"));
DashboardIndex is the PartialView.
Att.
Junior
Why are the controls not rendered within PartialView?
When my application calls a PartialView, the grid is not rendered and the DatePicker control is not rendered correctly in this PartialView.
The PartialView is called like this: $('#contents').load("@Url.Action("DashboardIndex","Dashboard"));
DashboardIndex is the PartialView.
Att.
Junior
SIGN IN To post a reply.
5 Replies
CJ
Carlos Junior
January 31, 2017 04:39 PM UTC
Problem solved!
I added the following statement at the end of PartialView: @Html.EJ().ScriptManager()
Att.
Junior
I added the following statement at the end of PartialView: @Html.EJ().ScriptManager()
Att.
Junior
SS
Seeni Sakthi Kumar Seeni Raj
Syncfusion Team
February 1, 2017 04:39 AM UTC
Hi Carlos,
We are happy to hear that you have resolved your problem. Please get back to us, if you require further assistance on this.
Regards,
Seeni Sakthi Kumar S.
NI
Nicola
March 8, 2017 11:28 PM UTC
Hello,
I have the same problem, I tried to add the : @Html.EJ().ScriptManager() at the end of PartialView but doesn't work !
---------------------------------------------------------------------------------------
In the principal view
---------------------------------------------------------------------------------------
<div id="partialIncassi">
@{ Html.RenderAction("ReportIncassi", "Report", Model);}
</div>
$("#button_filter").click(function () {
$('#partialIncassi').load('@Url.Action("ReportIncassi", "Report")',$("#filtroForm").serialize());
---------------------------------------------------------------------------------------
PartialView (_ReportIncassiGroup)
---------------------------------------------------------------------------------------
<div class="row">
@(Html.EJ().Grid<AfroditeProPortal.Models.IncassiModel>
("Grid")
.Datasource((IEnumerable<object>)ViewBag.incassi)
.AllowGrouping()
.GroupSettings(group => { group.GroupedColumns(col => { col.Add("tipoArticolo"); }); })
.Locale("it-IT")
.ShowSummary()
.SummaryRow(row =>
{
row.ShowTotalSummary(true)
.SummaryColumns(col =>
{
col.SummaryType(SummaryType.Sum)
.DisplayColumn("qta")
.DataMember("qta")
.Prefix("Quantità = ")
.Format("{0:N0}")
.Add();
col.SummaryType(SummaryType.Sum)
.DisplayColumn("importo")
.DataMember("importo")
.Prefix("Totale = ")
.Format("{0:C}")
.Add();
col.SummaryType(SummaryType.Sum)
.DisplayColumn("importoScontato")
.DataMember("importoScontato")
.Prefix("Totale = ")
.Format("{0:C}")
.Add();
col.SummaryType(SummaryType.Sum)
.DisplayColumn("omaggio")
.DataMember("omaggio")
.Prefix("Totale = ")
.Format("{0:C}")
.Add();
col.SummaryType(SummaryType.Sum)
.DisplayColumn("omaggi")
.DataMember("omaggi")
.Prefix("Omaggi = ")
.Format("{0:N0}")
.Add();
}).Add();
})
.Columns(col =>
{
col.Field(c => c.sesso).HeaderText("Sesso").Width("10%").Add();
col.Field(c => c.tipoArticolo).HeaderText("Tipo").Width("15%").Add();
col.Field(c => c.qta).HeaderText("Quantità").Width("15%").TextAlign(TextAlign.Center).Format("{0:N0}").Add();
col.Field(c => c.importo).HeaderText("Importo").Width("15%").TextAlign(TextAlign.Center).Format("{0:C}").Add();
col.Field(c => c.importoScontato).HeaderText("Sconti").Width("15%").TextAlign(TextAlign.Center).Format("{0:C}").Add();
col.Field(c => c.omaggio).HeaderText("Omaggi").Width("15%").TextAlign(TextAlign.Center).Format("{0:N0}").Add();
col.Field(c => c.omaggi).HeaderText("Importo omaggi").Width("15%").TextAlign(TextAlign.Center).Format("{0:C}").Add();
})
)
</div>
@Html.EJ().ScriptManager()
---------------------------------------------------------------------------------------
Controller
---------------------------------------------------------------------------------------
public PartialViewResult ReportIncassi(ReportIncassiFiltro filtro)
{
ReportData reportData = new ReportData();
ViewBag.incassi = reportData.getIncassiSerProd(filtro);
return PartialView("_ReportIncassiGroup");
}
NI
Nicola
March 8, 2017 11:41 PM UTC
I changed the javascritp .load with ajax call and i used ej.widget.init without @Html.EJ().ScriptManager() in PartialView, and works !!
$.ajax({
url: '@Url.Action("ReportIncassi", "Report")',
data:$("#filtroForm").serialize(),
success: function (doc) {
$("#partialIncassi").html(doc);
ej.widget.init($("#partialIncassi"));
}
});
VA
Venkatesh Ayothi Raman
Syncfusion Team
March 9, 2017 06:19 AM UTC
Hi Nicola,
Thanks for the update.
The reason is UnobtrusiveJavaScriptEnabled is enabled in the webconfig file like as follows,
|
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
. . .
</connectionStrings>
<appSettings>
. . .
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
. . .
</appSettings> |
If it is enabled in your project then we should use ej.widget.init for partial view as like your code example. We are happy to hear that your requirement is achieved.
Thanks,
Venkatesh Ayothiraman.
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
-
CJ Carlos Junior
- Jan 31, 2017 01:10 PM UTC
- Mar 9, 2017 06:19 AM UTC