Using the panel does not work either.
With version 0.8 worked fine.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/UserControl/ChooserDialog.ascx" TagName="ChooserDialog" tagprefix="uc1" %>
<script runat="server">
private List<object> GetImages(string path)
{
string serverPath = Server.MapPath(path);
string[] files = System.IO.Directory.GetFiles(serverPath);
List<object> data = new List<object>(files.Length);
foreach (string fileName in files)
{
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
long size = fi.Length;
string strSize = size < 1024 ? size + " bytes" : (Math.Round(((size * 10.0) / 1024)) / 10) + " KB";
data.Add(new
{
name = fi.Name,
url = path + fi.Name,
sizeString = strSize,
lastmod = fi.LastAccessTime
});
}
return data;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Button1.Listeners.Click.Handler = string.Format("openDialog({0}_class,{1},{2});", this.ChooserDialog1.ClientID, this.Store1.ClientID, this.ChooserDialog1.WindowID);
}
}
protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
this.Store1.DataSource = this.GetImages(e.Parameters["folder"]);
this.Store1.DataBind();
}
</script>
<!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>Advanced DataView - Ext.NET Example</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" Mode="Script" runat="server" />
<link href="chooser.css" rel="stylesheet" type="text/css" />
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
<script src="js/ChooserDialog.js" type="text/javascript"></script>
<script type="text/javascript">
var insertImage = function(data) {
Ext.DomHelper.append("images", {
tag: "img",
src: data.url,
style: "margin:10px;visibility:hidden;"
}, true).show(true).frame();
};
var openDialog = function(dialog, store, window) {
store.directEventConfig.eventMask.customTarget = window.body;
dialog.show();
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>Advanced DataView</h1>
<p>This example shows loading a DataView in a window. Each item has a linked details view, and the DataView supports custom sorting and filtering.</p>
<ext:Store runat="server" ID="Store1" AutoLoad="false" OnRefreshData="Store1_RefreshData">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="name" />
<ext:RecordField Name="url" />
<ext:RecordField Name="sizeString" />
<ext:RecordField Name="lastmod" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
</Fields>
</ext:JsonReader>
</Reader>
<DirectEventConfig>
<EventMask ShowMask="true" Target="CustomTarget" />
</DirectEventConfig>
</ext:Store>
<ext:Panel
ID="FormPanelAnagrafica_Mezzi"
runat="server"
Title="Inserimento"
MonitorValid="true"
Width="1360"
Collapsible="true"
Border="true"
BodyStyle="padding:5px;border-bottom:1px solid #99BBE8;border-left:1px solid #99BBE8;border-right:1px solid #99BBE8;"
ButtonAlign="Right">
<Content>
<uc1:ChooserDialog ID="ChooserDialog1" runat="server" StoreID="Store1" Callback="insertImage" Folder="../../Shared/images/thumbs/" />
</Content>
</ext:Panel>
<ext:Button
ID="Button1"
runat="server"
Text="Insert an Image from the Folder 1"
StyleSpec="display:inline"
/>
<ext:Button
ID="Button2"
runat="server"
Text="Insert an Image from the Folder 2"
StyleSpec="display:inline"
/>
<div id="images" style="margin:20px;width:600px;">
</form>
</body>
</html>