Jan 31, 2011, 12:14 PM
[CLOSED] FileUpload in toolbar not rendered correctly
Hello,
I need urgent help with upload control in toolbar.
I put upload control in toolbar but browse button is not rendered correctly (I try in IE 8 and Firefox and same thing in both browsers).
Second question is:
Is it possible immediate upload selected file to server with upload control when I browse and select file
in "Choose file dialog" and click "Open" (immediate upload file without click on btnAdd shown in my code bellow)?
This is my sample code in usercontrol:
Sasa
I need urgent help with upload control in toolbar.
I put upload control in toolbar but browse button is not rendered correctly (I try in IE 8 and Firefox and same thing in both browsers).
Second question is:
Is it possible immediate upload selected file to server with upload control when I browse and select file
in "Choose file dialog" and click "Open" (immediate upload file without click on btnAdd shown in my code bellow)?
This is my sample code in usercontrol:
<%@ControlLanguage="C#"AutoEventWireup="true"CodeFile="ScanEdit.ascx.cs"Inherits="ScanEdit" %>
<%@RegisterAssembly="Ext.Net"Namespace="Ext.Net"TagPrefix="ext" %>
<ext:XScriptID="XScript1"runat="server">
<scripttype="text/javascript">
function SelectedFile()
{
var cfile = #{FileUpload}.getValue().toLowerCase().trim();
var bisempty = (cfile.match("\.mdb$") == null);
if(bisempty)
{
#{FileUpload}.reset();
#{btnAdd}.disable();
}
else
{
#{btnAdd}.enable();
}
}
</script>
</ext:XScript>
<ext:Window ID="frmScanEdit" runat="server" Icon="Pictures" Title="Test sample..."
Width="930" Height="430" MinHeight="300" MinWidth="750" AutoShow="false" Modal="true" Layout="Fit" Hidden="true"
Resizable="true" Draggable="true" >
<Items>
<ext:Panel ID="pnlBorder" runat="server" Width="650" Layout="border" Height="300" Border="false">
<TopBar>
<ext:Toolbar ID="Toolbar2" runat="server">
<Items>
<ext:FileUploadField ID="FileUpload" runat="server" ButtonText="Browse..." Icon="Attach" EmptyText="only files with following extension: .mdb ...">
<Listeners>
<FileSelected Handler="SelectedFile();" />
</Listeners>
</ext:FileUploadField>
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="4"/>
<ext:Button ID="btnAdd" runat="server" Disabled="true" Icon="Add">
<DirectEvents>
<Click OnEvent="UploadFile">
<EventMask ShowMask="true" Target="CustomTarget" Msg="Uploading file..." CustomTarget="={#{frmScanEdit}.body}" />
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:Panel runat="server" ID="pnlCenter" Region="Center" Border="false">
<Items>
<ext:Label runat="server" ID="lblTest"/>
<Items
</ext:Panel>
<ext:Panel ID="pnlSouth" runat="server" Region="South" Height="150" Split="true" Collapsible="true" Border="false" AutoScroll="true">
<Items>
<ext:Image
ID="Image1"
runat="server"
AutoShow="true"
ImageUrl="../images/none.png">
</ext:Image>
</Items>
</ext:Panel>
</Items>
<BottomBar>
<ext:StatusBar ID="FormStatusBar" runat="server" DefaultText="Fill data..." BusyIcon="Accept" BusyText="Checking..."/>
</BottomBar>
</ext:Panel>
</Items>
</ext:Window>
Code behind in .cs fileusing System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Ext.Net;
publicpartialclassScanEdit : System.Web.UI.UserControl
{
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid UploadFile(object sender, DirectEventArgs e)
{
if (this.FileUpload.HasFile)
{
}
}
}
Best regards,Sasa
Last edited by Daniil; Feb 02, 2011 at 10:37 AM.
Reason: Removed <font> tags, [CLOSED]