Jan 21, 2019 02:33 AM|Ackerly Xu|LINK
Don't clear why you put your fileupload in a gridview's gridview. If your fileupload is in a gridview , you couldn't get the fileload by (TryCast(gvPhoneBook.Rows(e.RowIndex).
You should first find your girdview.
Dim gird as GridView =(TryCast(gvPhoneBook.Rows(e.RowIndex).FindControl("id of your gridview"), GridView))
And the find the fileupload through the gridview's row.
Dim fupload As FileUpload = (TryCast(grid.Rows(index of the row where your fileupload is ).FindControl("FileUpload2"), FileUpload))
If you want to ensure the fileupload has file, you could write the code below.
If Not String.IsNullOrEmpty(fupload.FileName) Then // upload your file and do update query
// take path from row called laebel5
About your second question, because number of days in a month is not sure, the api doesn't provide the method.
You should define how many days there are in a month (30,31 or 29) and divide the number of days between the two dates by your customized number of days in a month.