PDA

View Full Version : [CLOSED] FileUploadField causes a problem when firing a direct event of a button



thchuong
May 14, 2012, 3:34 PM
Hi,

As the topic title, I get the following error as firing a direct event of a button
4236

Please tell me how to prevent that. I can guest the reason is that the form has been set enctype to multipart/form-data.


<head runat="server">
<title></title>
<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"
});
}
}
protected void ErrorClick_Event(object sender, DirectEventArgs e)
{
}


</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server">
</ext:ResourceManager>
<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 runat="server" ID="btnError" Text="Post back" Icon="Error">
<DirectEvents>
<Click OnEvent="ErrorClick_Event"></Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="SaveButton" runat="server" Text="Save">
<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 ID="Button1" runat="server" Text="Reset">
<Listeners>
<Click Handler="#{BasicForm}.getForm().reset();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>

Daniil
May 14, 2012, 4:27 PM
Hi,

I am unable to reproduce the problem.

Please clarify what Ext.NET sources do you use? If not the latest one from SVN, please update and re-test.

thchuong
May 15, 2012, 4:26 AM
Hi,

It is now working after updating svn. Thanks for your help.

One question : how often do you update it on Nuget?

Daniil
May 15, 2012, 9:48 AM
One question : how often do you update it on Nuget?

Currently, we don't update NuGet, only on releases. Beta 2 should appear soon.