I have the following code to save the attachments in a folder outside the DB.
Line 5 is giving me troubles during the creation of new records because the value to assign to "recordID" at the time of creation of a new record does not yet exist.
So my idea is to add a condition on top of this method that would execute it only if a new record is not being created. Something along those lines.....
How can I do something like that?
Line 5 is giving me troubles during the creation of new records because the value to assign to "recordID" at the time of creation of a new record does not yet exist.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem edititem = (GridEditableItem)e.Item; GridEditableItem editedItem = e.Item as GridEditableItem; string recordID = editedItem.GetDataKeyValue("TransazioneID").ToString(); string subPath = "Allegati\\" + recordID; bool isExists = System.IO.Directory.Exists(Server.MapPath(subPath)); if (!isExists) System.IO.Directory.CreateDirectory(Server.MapPath(subPath)); RadUpload upload = (edititem.EditManager.GetColumnEditor("columnAllegati") as GridAttachmentColumnEditor).RadUploadControl; upload.TargetFolder = "Allegati\\" + recordID; } }How can I do something like that?