Posted on: 10/16/2015 2:32:06 PM | Views : 1249

I have a file that is being created based on the items in a repeater  control if the radiobutton for each item is "Yes" . My issue is that if the file is empty, I do not want it to be created. I have tried FileName.Length > 0, and many other solutions but it still is being created or errors out that the file can not be found. Any ideas?
protected void btnContinue_Click(object sender, EventArgs e) { string JobName; string FileName; StreamWriter sw; string Name, Company, Date; JobName = TYest + "_" + System.DateTime.Now; JobName = JobName.Replace(":", "").Replace("/", "").Replace(" ", ""); FileName = JobName + ".txt"; sw = new StreamWriter(C: + "/" + FileName, false, Encoding.GetEncoding(1250)); ...

Go to the complete details ...