Welcome Guest Search | Active Topics | Sign In | Register

Gridview & ProgressBar Options
Jamie Chung
Posted: Monday, December 20, 2010 12:28:40 AM
Rank: Newbie
Groups: Member

Joined: 12/19/2010
Posts: 1
Hi there,

I used the EO.Web.ProgressBar but in RunTask function can not use "GridView.DataBind();" , how should do it?

Code: C#

protected void ProgressBar1_RunTask(object sender, EO.Web.ProgressTaskEventArgs e)
{
//ProgressBar1.Visible = true;

e.UpdateProgress(0);

string strFilePath = "";//?
m_bFirst = true;
ArrayList alFileSize = new ArrayList();
ArrayList al = new ArrayList();

int iStart = 0;
int iEnd = 0;

m_UpLoadFile = this.FileUpload1.PostedFile;//UpLoadFile物件

m_strUpLoadFilePath = m_UpLoadFile.FileName; //UpLoadFile物件取得上傳路徑

if (!checkFile(m_strUpLoadFilePath))
{
return;
}

if (m_strUpLoadFileEx == ".txt")
{

m_strUpLoadFileName = Path.GetFileName(m_strUpLoadFilePath);
m_UpLoadFile.SaveAs(Server.MapPath("~/LogFile/" + m_strUpLoadFileName));
strFilePath = Server.MapPath("~/LogFile/" + m_strUpLoadFileName);

FileInfo fi = new FileInfo(strFilePath);//-----Get File Length-----//
alFileSize.Add(fi.Length);

ReadFilefirst(strFilePath);
for (int i = 0; i < m_alPreTestItem.Count; i++)
{
m_alTestItem.Add(m_alPreTestItem[i]);
m_alValue.Add(0);
}
ParsingFile(m_strUpLoadFileName, strFilePath);
}

else if (m_strUpLoadFileEx == ".zip")
{
m_strUpLoadFileName = Path.GetFileName(m_strUpLoadFilePath);
m_UpLoadFile.SaveAs(Server.MapPath("~/Temp/" + m_strUpLoadFileName));
strFilePath = Server.MapPath("~/Temp/" + m_strUpLoadFileName);
MySharpZip.CZip oZip = new MySharpZip.CZip();

string rc = oZip.UnZipFile(strFilePath, Server.MapPath("LogFile"));
if (rc == "Success")
{
string[] strUnzipFolder = Directory.GetDirectories(Server.MapPath("LogFile"));


// for (int iFolder = 0; iFolder < strUnzipFolder.Length; iFolder++ )
{

DirectoryInfo di = new DirectoryInfo(strUnzipFolder[0]);//-----Get File Length-----//
FileInfo[] fiArr = di.GetFiles();
long lTotalFileSize = 0;

foreach (FileInfo f in fiArr)
{
alFileSize.Add(f.Length);
lTotalFileSize += f.Length;
}

string[] strUnzipFile = Directory.GetFiles(strUnzipFolder[0]);

for (int iFile = 0; iFile < strUnzipFile.Length; iFile++)
{
al.Add(strUnzipFile[iFile]);
}
al.Sort();

if (CheckBox2.Checked)
{
for (int iFile = 0; iFile < strUnzipFile.Length; iFile++)
{
strFilePath = strUnzipFile[iFile];

m_strUpLoadFileName = Path.GetFileName(strFilePath);
ReadFilefirst(strFilePath);

//ParsingFile(m_strUpLoadFileName, strFilePath);
}

for (int i = 0; i < m_alPreTestItem.Count; i++)
{
m_alTestItem.Add(m_alPreTestItem[i]);
m_alValue.Add(0);
}


for (int iFile = 0; iFile < strUnzipFile.Length; iFile++)
{
strFilePath = strUnzipFile[iFile];

m_strUpLoadFileName = Path.GetFileName(strFilePath);

ParsingFile(m_strUpLoadFileName, strFilePath);
e.UpdateProgress(100 * (iFile + 1) / strUnzipFile.Length);
}
}
else
{
string strCurLot = "";
string strPreLot = "";
for (int iFile = 0; iFile < strUnzipFile.Length; iFile++)
{
strFilePath = strUnzipFile[iFile];
m_strUpLoadFileName = Path.GetFileName(strFilePath);
//ReadFilefirst(strFilePath);
GetLotNumSite(m_strUpLoadFileName, strFilePath);
strCurLot = m_strLotNum;

if (strPreLot != strCurLot && strPreLot != "" || iFile == strUnzipFile.Length - 1)
{
m_iSerialNum = 0;
m_bFirst = true;
iEnd = iFile;

if (iFile == strUnzipFile.Length - 1)
{
iEnd += 1;
}


for (int x = iStart; x < iEnd; x++)
{
strFilePath = strUnzipFile[x];
ReadFilefirst(strFilePath);
}

for (int i = 0; i < m_alPreTestItem.Count; i++)
{
m_alTestItem.Add(m_alPreTestItem[i]);
m_alValue.Add(0);
}

for (int x = iStart; x < iEnd; x++)
{
strFilePath = strUnzipFile[x];

m_strUpLoadFileName = Path.GetFileName(strFilePath);

ParsingFile(m_strUpLoadFileName, strFilePath);
e.UpdateProgress(100 * (x + 1) / strUnzipFile.Length);

for (int i = 0; i < m_alValue.Count; i++)
{
m_alValue[i] = 0;
}
}

iStart = iFile;

CleanAllList();
}

strPreLot = strCurLot;
}

}

}
}

}

for (int i = 0; i < m_alFileList.Count; i++)
{
m_swLogFile = (StreamWriter)m_alFileList[i];
m_swLogFile.Close();
}

m_iSerialNum = 0;
e.UpdateProgress(100);

CleanAllList();

Label2.Text = "";
CheckBox1.Checked = false;
CheckBox2.Checked = false;
CheckBox1.Enabled = true;
CheckBox2.Enabled = true;
GridView5.DataBind();

}
eo_support
Posted: Monday, December 20, 2010 9:18:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Please let us know whether you have a license with our product. Because toolbar is a free control, we do not offer free tech support for it unless you have a license for any of our other product.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.