View Full Version : [CLOSED] MVC - Loading UserControl's with PartialViewResult

Jun 13, 2013, 1:35 PM
Hi @all,

I load on clientside with jscript UserControls in Asp - Repeater.

Here some code snippets to understand the situation.


var p_new_item = new Ext.Panel({
id: name_control,
layout: 'fit',
border: false

var p_loader = new Ext.Panel({
id: name_loader,
border: false,
hidden: true,
loader: {
url: url,
disableCaching: true,
scripts: true,
params: {
containerId: p_new_item.id,
contSID: contSID



public ActionResult uc_ContText(string containerId, string contSID)

this.ViewData["contSID"] = contSID;

var pr = new Ext.Net.MVC.PartialViewResult(containerId);
pr.ViewData = ViewData;
pr.RenderMode = Ext.Net.RenderMode.AddTo;
pr.SingleControl = true;
pr.IDMode = Ext.Net.IDMode.Explicit;

return pr;

That works with a UserControl (.ascx) which was developed with Ext.Net but not with UserControl with Asp-Code.
If I build a ext:Panel around the asp-div, it works too!


<ext:Panel runat="server">
//My UserContol.....

How I can Asp-UserControls load without Ext.Net -Code ??

Jun 13, 2013, 2:29 PM
Hi @ontiv,

I think you cannot use these options:

pr.RenderMode = Ext.Net.RenderMode.AddTo;
pr.SingleControl = true;
if a partial view contains native ASP.NET controls on the top level.

It would be simplest to wrap an ASP.NET control in an additional Ext.NET container.

<ext:Container runat="server">
<asp:Label runat="server" Text="Hello!" />

Also I would recommend you to use Mode="Component" for a Loader.



<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<head runat="server">
<title>Ext.Net.MVC v2 Example</title>
<ext:ResourceManager runat="server" />

<ext:Panel ID="Panel1" runat="server" Width="200" Height="200">
<Loader runat="server" Mode="Component" Url="/Aspx/Partial" />

Partial View

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<ext:Container runat="server">
<asp:Label runat="server" Text="Hello!" />

Controller Action

public ActionResult Partial()
return Json(ComponentLoader.ToConfig("~/Views/Aspx/Partial.ascx"), JsonRequestBehavior.AllowGet);

Jun 19, 2013, 8:39 AM
Hi Daniil,

thanks for your help.