I am writing some C# code that transfers data from files into a database. I show the files to be processed in one list box and once processed I wish to transfer it from that listbox to another. Unfortunately it doesn't show any of the moves until after all the processing is completed. Can anyone show me what I am doing wrong?
C#
This is really bugging me. :)
<
telerik:RadAjaxPanel
ID
=
"RP1"
runat
=
"server"
Width
=
"100%"
>
<
br
/>
<
table
class
=
"style2"
>
<
tr
>
<
td
align
=
"center"
width
=
"33%"
>
<
asp:Label
ID
=
"lblUpload"
runat
=
"server"
ForeColor
=
"#000099"
Text
=
"Uploaded"
Visible
=
"False"
></
asp:Label
>
</
td
>
<
td
align
=
"center"
width
=
"33%"
>
</
td
>
<
td
align
=
"center"
width
=
"33%"
>
<
asp:Label
ID
=
"lblProcessed"
runat
=
"server"
ForeColor
=
"#000099"
Text
=
"Imported"
Visible
=
"False"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"center"
valign
=
"top"
width
=
"50%"
>
<
telerik:RadListBox
ID
=
"UploadListBox"
runat
=
"server"
Visible
=
"False"
Width
=
"350px"
AllowDelete
=
"True"
TransferToID
=
"ProcessedListBox"
>
<
ButtonSettings
TransferButtons
=
"All"
></
ButtonSettings
>
</
telerik:RadListBox
>
</
td
>
<
td
align
=
"center"
valign
=
"top"
width
=
"50%"
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
onclick
=
"RadButton1_Click"
Text
=
"Transfer to Database"
>
</
telerik:RadButton
>
</
td
>
<
td
align
=
"center"
valign
=
"top"
width
=
"50%"
>
<
telerik:RadListBox
ID
=
"ProcessedListBox"
runat
=
"server"
Visible
=
"False"
Width
=
"350px"
>
<
ButtonSettings
TransferButtons
=
"All"
></
ButtonSettings
>
</
telerik:RadListBox
>
</
td
>
</
tr
>
</
table
>
</
telerik:RadAjaxPanel
>
C#
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
{
int
tcount = UploadListBox.Items.Count;
if
(tcount < 1)
{
lblMessage.Text=
"You must have files to process."
;
return
;
}
int
increment = 100 / tcount;
int
completed = 0;
string
pfile;
string
[] fileparts;
for
(
int
i = 0; i < (tcount); i++)
{
string
filetype;
InitMstrVariables();
InitFGVariables();
InitTransactionSet();
pfile = UploadListBox.Items[0].Value.ToString();
fileparts = pfile.Split(
'_'
);
MstrType = Right(fileparts[1], 1).ToUpper();
Batch = Convert.ToInt32(fileparts[0]);
MstrYearMonth = Convert.ToInt32(Left(fileparts[3], 6));
DateCreated = StrToDate(fileparts[3]);
filetype = Left(fileparts[1], 3);
if
(filetype ==
"834"
)
{
DeleteBatch834();
ProcessFile834(pfile);
}
else
if
(filetype ==
"820"
)
{
DeleteBatch820();
ProcessFile820(pfile);
}
var item =
new
Telerik.Web.UI.RadListBoxItem();
item.Value = pfile;
item.Text = pfile;
UploadListBox.Transfer(UploadListBox.Items[0], UploadListBox, ProcessedListBox);
File.Delete(filepath + pfile);
completed = completed + increment;
}
}
}
This is really bugging me. :)