AI OnAI Off
,
<%# GetFileLength(Container.CurrentPage["varFilePath"].ToString())%>
aspx.cs
public string GetFileLength(string FilePath)
{
string _getFileInfo = "";
try
{
FileInfo finfo = new FileInfo(Server.MapPath(FilePath));
long FileInKB = finfo.Length / 1024;
_getFileInfo = FileInKB.ToString();
}
catch (NotSupportedException)
{
}
catch (ArgumentException)
{
}
catch (IOException)
{
}
catch(HttpException)
{
}
return _getFileInfo;
}
ascx <%# getfilelength(container.currentpage)%> kb ascx.cs public string GetFileLength(PageData pdFileInfo) { FileInfo fi = new FileInfo(pdFileInfo.Property["varFilePath"].ToString()); return fi.Length.ToString(); } %#>
Any better ideas anyone? Thanks. Victor