Dec 07, 2011, 10:31 AM
[CLOSED] Problem with Firefox and Chrome
Hello,
in my MVC application I have the following page:
This message is properly displayed in IE9 but nothing happens with Firefox (I'm using 8.0.1) and Chrome (15.0.874.121).
Bye,
Stefano
in my MVC application I have the following page:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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 id="Head1" runat="server">
<title></title>
<ext:ResourcePlaceHolder ID="MainResourcePlaceHolder" runat="server" />
<script type="text/javascript">
var onGridCommand = function (command, record, rowIndex, colIndex) {
Ext.net.DirectMethod.request({
url: "/EasyRapp/Support/UploadFileList",
cleanRequest: true
});
};
</script>
</head>
<body>
<ext:ResourceManager ID="MainScriptManager" runat="server" DisableViewState="true"/>
<ext:Store ID="dsEmployees" runat="server" RemoteSort="true">
<Proxy>
<ext:HttpProxy Url="~/Support/GetEmployeeList/" />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="EmployeeId" Root="data" TotalProperty="total">
<Fields>
<ext:RecordField Name="EmployeeId" Type="Int"/>
<ext:RecordField Name="EmployeeCode" />
<ext:RecordField Name="FirstName" />
<ext:RecordField Name="LastName" SortDir="ASC" />
</Fields>
</ext:JsonReader>
</Reader>
<SortInfo Field="LastName" Direction="ASC" />
</ext:Store>
<ext:Viewport ID="MainViewport" runat="server" Layout="BorderLayout">
<Items>
<ext:GridPanel
ID="MainGridPanel"
runat="server"
Region="Center"
Layout="FitLayout"
Border="false"
TrackMouseOver="true"
StoreID="dsEmployees"
StripeRows="true">
<ColumnModel ID="MainColumnModel" runat="server">
<Columns>
<ext:ImageCommandColumn Width="46" Resizable="false">
<Commands>
<ext:ImageCommand CommandName="Attachment" Icon="Attach" />
</Commands>
</ext:ImageCommandColumn>
<ext:Column ColumnID="EmployeeId" DataIndex="EmployeeId" Header="ID" Hidden="true" />
<ext:Column ColumnID="EmployeeCode" DataIndex="EmployeeCode" Header="Codice" />
<ext:Column ColumnID="LastName" DataIndex="LastName" Header="LastName" />
<ext:Column ColumnID="FirstName" DataIndex="FirstName" Header="FirstName" />
</Columns>
</ColumnModel>
<Listeners>
<Command Fn="onGridCommand" />
</Listeners>
<SelectionModel>
<ext:RowSelectionModel ID="MainRowSelectionModel" runat="server" />
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Viewport>
</body>
</html>
When you click the Attachment ImageCommand the following .ascx is rendered:<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
var YContext = {
HelloText: "Hello from YContext"
};
</script>
<ext:Window
ID="UPLListWindow"
Modal="true"
runat="server"
Title="Allegati"
Icon="Attach"
Width="800"
Height="400"
MinWidth="320"
MinHeight="200"
Layout="FitLayout"
CloseAction="Close"
Closable="true">
<Items>
<ext:FormPanel
ID="UPLMainFormPanel"
runat="server"
Border="false"
Layout="FitLayout">
<Items>
<ext:GridPanel
ID="YMainGridPanel"
runat="server"
Header="false"
Border="false"
TrackMouseOver="true"
AutoExpandColumn="AttachmentName"
StripeRows="true">
<Store>
<ext:Store ID="dsAttachments" runat="server" AutoLoad="true">
<Proxy>
<ext:HttpProxy Url="/EasyRapp/Support/GetAttachmentList/" />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="AttachmentId" Root="data">
<Fields>
<ext:RecordField Name="AttachmentId" Type="Int" />
<ext:RecordField Name="AttachmentName" />
</Fields>
</ext:JsonReader>
</Reader>
<SortInfo Field="AttachmentName" Direction="ASC" />
</ext:Store>
</Store>
<ColumnModel ID="UPLColumnModel" runat="server">
<Columns>
<ext:Column ColumnID="AttachmentId" DataIndex="AttachmentId" Header="ID" Width="75" Hidden="true"/>
<ext:Column ColumnID="AttachmentName" DataIndex="AttachmentName" Header="Title" />
</Columns>
</ColumnModel>
<TopBar>
<ext:Toolbar ID="UPLTopToolbar" runat="server" EnableOverflow="false">
<Items>
<ext:Button
ID="UPLButtonUpload"
runat="server"
Text=" Upload"
Icon="DiskUpload">
<Listeners>
<Click Handler="alert(YContext.HelloText);" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
</Items>
</ext:FormPanel>
</Items>
</ext:Window>
This is the controller code:....
private class MyEmployee
{
public int EmployeeId;
public string EmployeeCode;
public string FirstName;
public string LastName;
}
private class MyAttachment
{
public int AttachmentId;
public string AttachmentName;
}
public ActionResult EmployeeList()
{
return View();
}
public AjaxStoreResult GetEmployeeList()
{
List<MyEmployee> list = new List<MyEmployee>();
list.Add(new MyEmployee { EmployeeId = 1, EmployeeCode = "0001", FirstName = "FirstName1", LastName = "LastName1" });
list.Add(new MyEmployee { EmployeeId = 2, EmployeeCode = "0002", FirstName = "FirstName2", LastName = "LastName2" });
list.Add(new MyEmployee { EmployeeId = 3, EmployeeCode = "0003", FirstName = "FirstName3", LastName = "LastName3" });
list.Add(new MyEmployee { EmployeeId = 4, EmployeeCode = "0004", FirstName = "FirstName4", LastName = "LastName4" });
list.Add(new MyEmployee { EmployeeId = 5, EmployeeCode = "0005", FirstName = "FirstName5", LastName = "LastName5" });
return new AjaxStoreResult(list, 5);
}
public Ext.Net.MVC.PartialViewResult UploadFileList()
{
Ext.Net.MVC.PartialViewResult pvr = new Ext.Net.MVC.PartialViewResult();
return pvr;
}
public AjaxStoreResult GetAttachmentList()
{
List<MyAttachment> list = new List<MyAttachment>();
list.Add(new MyAttachment { AttachmentId = 1, AttachmentName = "Attachment1" });
list.Add(new MyAttachment { AttachmentId = 2, AttachmentName = "Attachment2" });
list.Add(new MyAttachment { AttachmentId = 3, AttachmentName = "Attachment3" });
return new AjaxStoreResult(list, 3);
}
.....
Now, if you click the UPLButtonUpload toolbar button you should see an Hello alert message.This message is properly displayed in IE9 but nothing happens with Firefox (I'm using 8.0.1) and Chrome (15.0.874.121).
Bye,
Stefano
Last edited by Daniil; Dec 07, 2011 at 12:44 PM.
Reason: [CLOSED]