PDA

View Full Version : [CLOSED] FileUpload can't work....



gs_user
May 08, 2012, 1:33 AM
hi,
I download ext.net Basic FileUpload sample
the Browse button can't now work
Do I miss some step???
I don't change any code...



<%@ Page Language="C#" %>

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

<script runat="server">
protected void UploadClick(object sender, DirectEventArgs e)
{
string tpl = "Uploaded file: {0}<br/>Size: {1} bytes";

if (this.FileUploadField1.HasFile)
{
X.Msg.Show(new MessageBoxConfig
{
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.INFO,
Title = "Success",
Message = string.Format(tpl, this.FileUploadField1.PostedFile.FileName, this.FileUploadField1.PostedFile.ContentLength)
});
}
else
{
X.Msg.Show(new MessageBoxConfig
{
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.ERROR,
Title = "Fail",
Message = "No file uploaded"
});
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>FormPanel - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" type="text/css" />

<style type="text/css">
#fi-button-msg {
border: 2px solid #ccc;
padding: 5px 10px;
background: #eee;
margin: 5px;
float: left;
}
</style>

<script type="text/javascript">
var showFile = function (fb, v) {
if (v) {
var el = Ext.get('fi-button-msg');
el.update('<b>Selected:</b> ' + v);

if (!el.isVisible()) {
el.slideIn('t', {
duration: .2,
easing: 'easeIn',
callback: function () {
el.highlight();
}
});
} else {
el.highlight();
}
}
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<h1>File Upload Field</h1>

<h2>Basic FileUpload</h2>

<p>A typical file upload field with Ext style. Direct editing of the text field cannot be done in a
consistent, cross-browser way, so it is always read-only in this implementation.</p>

<ext:FileUploadField ID="BasicField" runat="server" Width="400" Icon="Attach" />

<ext:Button runat="server" Text="Get File Path">
<Listeners>
<Click Handler="var v = #{BasicField}.getValue(); Ext.Msg.alert('Selected&nbsp;File', v && v != '' ? v : 'None');" />
</Listeners>
</ext:Button>

<h2>Basic FileUpload (Button-only)</h2>

<p>You can also render the file input as a button without the text field, with access to the field's value via the
standard <tt>TextField</tt> interface or by handling the <tt>FileSelected</tt> event (as in this example).</p>

<ext:FileUploadField runat="server" ButtonOnly="true">
<Listeners>
<Change Fn="showFile" />
</Listeners>
</ext:FileUploadField>

<div id="fi-button-msg" style="display:none;"></div>
<div class="x-clear"></div>

<h2>Form Example</h2>

<p>The FileUploadField can also be used in standard form layouts, with support for anchoring, validation (the
field is required in this example), empty text, etc.</p>

<ext:FormPanel
ID="BasicForm"
runat="server"
Width="500"
Frame="true"
Title="File Upload Form"
AutoHeight="true"
PaddingSummary="10px 10px 0 10px"
LabelWidth="50">
<Defaults>
<ext:Parameter Name="anchor" Value="95%" Mode="Value" />
<ext:Parameter Name="allowBlank" Value="false" Mode="Raw" />
<ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
</Defaults>
<Items>
<ext:TextField ID="PhotoName" runat="server" FieldLabel="Name" />
<ext:FileUploadField
ID="FileUploadField1"
runat="server"
EmptyText="Select an image"
FieldLabel="Photo"
ButtonText=""
Icon="ImageAdd"
/>
</Items>
<Listeners>
<ValidityChange Handler="#{SaveButton}.setDisabled(!valid);" />
</Listeners>
<Buttons>
<ext:Button ID="SaveButton" runat="server" Text="Save" Disabled="true">
<DirectEvents>
<Click
OnEvent="UploadClick"
Before="if (!#{BasicForm}.getForm().isValid()) { return false; }
Ext.Msg.wait('Uploading your photo...', 'Uploading');"

Failure="Ext.Msg.show({
title : 'Error',
msg : 'Error during uploading',
minWidth: 200,
modal : true,
icon : Ext.Msg.ERROR,
buttons : Ext.Msg.OK
});">
</Click>
</DirectEvents>
</ext:Button>
<ext:Button runat="server" Text="Reset">
<Listeners>
<Click Handler="#{BasicForm}.getForm().reset();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>
</html>

Vladimir
May 08, 2012, 6:59 AM
Hi,

What version do you use?
Please use latest code from svn
http://svn.ext.net/premium/branches/2.0

gs_user
May 08, 2012, 7:22 AM
How can I use latest code from svn?
I create a new site,
use Package manager console to install-package Ex.net -pre
I don't know how to use latest code


Hi,

What version do you use?
Please use latest code from svn
http://svn.ext.net/premium/branches/2.0

Vladimir
May 08, 2012, 7:28 AM
1. Use any svn client (for example, TortoiseSVN) and download code from remote repository (see the url above) using own svn credentials
2. Open solution in VS2010 and rebuild assemblies
3. Use new assemblies in your project

gs_user
May 08, 2012, 9:46 AM
I rebuild assemblies, it's can work
but my old project was used old assembilies
I try update the bin folder, but it's can work
please give me a suggestion,how to change old project dll ???


1. Use any svn client (for example, TortoiseSVN) and download code from remote repository (see the url above) using own svn credentials
2. Open solution in VS2010 and rebuild assemblies
3. Use new assemblies in your project

Daniil
May 08, 2012, 11:23 AM
I try update the bin folder, but it's can work

You should not directly deal with the "bin" folder.

There is the "References" in the Project. You can see that in Solution Explorer.

Remove the old Ext.NET.dll and add the new one.

gs_user
May 09, 2012, 2:46 AM
It's show can't not find namespace StoreRefreshDataEventArgs.
how to solve it????


You should not directly deal with the "bin" folder.

There is the "References" in the Project. You can see that in Solution Explorer.

Remove the old Ext.NET.dll and add the new one.

Vladimir
May 09, 2012, 6:49 AM
It was renamed to 'StoreReadDataEventArgs'
Please see
http://examples2.ext.net/#/GridPanel/Paging_and_Sorting/Page/

gs_user
May 09, 2012, 8:26 AM
It's work, thank you



It was renamed to 'StoreReadDataEventArgs'
Please see
http://examples2.ext.net/#/GridPanel/Paging_and_Sorting/Page/