I need help setting the size of flies in a grid-view, this first set of code works
protected string DisplaySize(long? size)
{
if (size == null)
return string.Empty;
else
{
if (size <1024)
{
return string.Format("{0:#} bytes", size.Value);
}
else
{
return String.Format("{0:#} KB", size.Value / 1024);
}
}
}
When I try to add more values it dose not work I just get blank values
protected string DisplaySize(long? size)
{
if (size == null)
return string.Empty;
else
{
if (size < 1024)
{
return string.Format("{0:#} bytes", size.Value);
}
else if(size < 10240)
{
return String.Format("{0:#} KB", (size.Value / 1024));
}
else if(size < 102400)
{
return String.Format("{0:#} MB", (size.Value / 1024 / 1024));
}
else
{
return String.Format("{0:#} GB", (size.Value / 1024 / 1024 / 1024));
}
}
}
Sumit Kesarwani
20-Nov-2014