Mar 28, 2010, 4:08 PM
[CLOSED] [1.0] ComboBox Problem
Hello,
The following demonstrates an issue with the ComboBox in MVC (2):
ExampleController.cs:
Cheers,
Timothy
The following demonstrates an issue with the ComboBox in MVC (2):
ExampleController.cs:
public class Example
{
public string Selected { get; set; }
}
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Child()
{
var example = new Example
{
Selected = "Timothy"
};
var result = PartialExtView(example);
result.ContainerId = "Panel1";
result.RenderMode = Ext.Net.RenderMode.AddTo;
result.WrapByScriptTag = false;
return result;
}
public ActionResult Child2()
{
return PartialExtView();
}
}
Index.aspx:<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Example</title>
</head>
<body>
<ext:ResourceManager runat="server" IDMode="Explicit" ScriptMode="Debug" Theme="Gray" />
<ext:Panel ID="Panel1" runat="server" Height="100">
<Listeners>
<AfterRender Handler="Ext.Ajax.request( {
disableCaching: true,
scripts: true,
success: function(response) {
eval(response.responseText)
},
url: '/Example/Child'
} );" />
</Listeners>
</ext:Panel>
</body>
</html>
Child.ascx:<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Web.Controllers.Example>" %>
<%= Html.RenderExtPartial("Child2", Model) %>
Child2.ascx:<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Web.Controllers.Example>" %>
<ext:ComboBox ID="ComboBox1" runat="server">
<Items>
<ext:ListItem Text="Timothy" Value="Timothy" />
</Items>
<SelectedItem AutoDataBind="true" Value='<%# Model.Selected %>' />
</ext:ComboBox>
Should select Timothy from the ComboBox1 but is not. I'm also seeing this problem with the TimeField but I suspect it's related because the TimeField inherits from the ComboBox.Cheers,
Timothy