Oct 17, 2011, 12:50 PM
FileUploadField and persistence of control field
Hi,
I have page with fields and upload button. First field is Id, which is for new records 0. After first save I update it's value to real Id. It works fine until I Add FileUploadField.
I create sample, to reproduce a problem try click save button multiple times. Value should change only first time.
I have page with fields and upload button. First field is Id, which is for new records 0. After first save I update it's value to real Id. It works fine until I Add FileUploadField.
I create sample, to reproduce a problem try click save button multiple times. Value should change only first time.
<script runat="server">
protected void SaveData(object sender, Ext.Net.DirectEventArgs e)
{
if (Id.Text == "0" || this.Id.Text == string.Empty)
{
Id.Value = DateTime.Now.Ticks;
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Field persistence test</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
<ext:ResourcePlaceHolder runat="server" Mode="Style" />
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" locale="cs-CZ"
viewstatemode="Disabled" ajaxviewstatemode="Disabled" enableviewstate="false" />
<ext:Window
id="mainWindow"
runat="server"
maximized="true"
maximizable="false"
closable="false"
plain="true"
border="false"
BodyBorder="false"
Resizable="false"
autoscroll="true"
modal="true">
<topbar>
<ext:Toolbar runat="server">
<Items>
<ext:TabStrip runat="server" id="tabs">
<Items>
<ext:TabStripItem actionitemid="pnlSummary" title="Souhrn" icon="BookOpen" />
</Items>
</ext:TabStrip>
<ext:ToolbarFill runat="server" />
<ext:button runat="server" icon="Disk" ondirectclick="SaveData" />
<ext:FileUploadField runat="server" ButtonOnly="true" id="ImportFile"
buttontext="Import" Icon="PageWhiteGet" visible="true" />
</Items>
</ext:Toolbar>
</topbar>
<items>
<ext:Panel ID="pnlSummary" runat="server" Header="false" frame="true">
<items>
<ext:tablelayout runat="server" columns="2" >
<cells>
<ext:cell rowspan="2">
<ext:fieldset runat="server" >
<items>
<ext:numberfield id="Id" fieldlabel="Id" runat="server" hidden="false"
width="300" allowdecimals="false" disabled="true"
IndicatorIcon="Information" Anchor="-20" IndicatorTip="Filled automatically" />
<ext:textfield id="Description" runat="server" fieldlabel="Popis" width="350" />
</items>
</ext:fieldset>
</ext:cell>
</cells>
</ext:tablelayout>
</items>
</ext:Panel>
</items>
</ext:Window>
</form>
</body>
</html>