PDA

View Full Version : [CLOSED] error accessing Model object from a modal window



RCM
Jul 20, 2012, 8:20 PM
Hi we are currently migrating from v1 to v2 and in V1 the following works but does not work in v2. The Model object of the page can no longer be accessed using the following format Text='<%# Model.Name%>'. Does this work differently for V2




model
public class UserModel
{
public string Name { get; set; }
}


controller
public ActionResult Showusers()
{
UserModel model = new UserModel(){Name = "Henry"};
Ext.Net.MVC.PartialViewResult partialViewResult = new Ext.Net.MVC.PartialViewResult();
partialViewResult.RenderMode = RenderMode.RenderTo;
partialViewResult.SingleControl = true;
partialViewResult.ViewData.Model = model;
partialViewResult.ViewName = "UserPageWindow";
return partialViewResult;
}



UserPageWindow ascx file


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl< UserModel>" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:Window ID="winAddServer" runat="server" Title='User description' Icon="Wrench" Modal="true"
Height="205" Width="300" Layout="fit" Hidden="false" Resizable="false" IDMode="Static"
AutoDataBind="true" Closable="true">
<Items>
<ext:Panel runat="server" BodyPadding="10" Header="false" Layout="Form" LabelAlign="Top">
<Items>
<ext:TextField runat="server" FieldLabel="User :" Text='<%# Model.Name%>'
EnableKeyEvents="true" TabIndex="10" AnchorHorizontal="100%" IDMode="Static" >
</ext:TextField>
</Items>
</ext:Panel>
</Items>


</ext:Window>

Daniil
Jul 20, 2012, 10:01 PM
Hi,

I got your code working as expected - I see "Henry" in the TextField.

I can't see any changes in v2 which could potentially stop it working.

Any more details how we can reproduce the issue?

Probably, a test project would be a best option. Please email to:
daniil at ext dot net