Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
27330 Points
5459 Posts
MVP
Feb 19, 2012 05:06 PM|LINK
OK I woudl add a checkbox to the Field_Edit.ascx file
<asp:CheckBox ID="DeleteCheckBox" runat="server" test="Delete" />
then in the ExtractValues method check the checkbox if set set the dictionary to null this will null the value
protected override void ExtractValues(IOrderedDictionary dictionary) { if (FileUpload1.HasFile) { string fileAttributeFullPath = Utility.FrontendPhysicalPath + GetFileAttributePath(); string fileName = Utility.GetRand() + "-" + FileUpload1.FileName; FileUpload1.SaveAs(fileAttributeFullPath + fileName); if (!String.IsNullOrEmpty(ViewState["FieldValueString"].ToString())) try { File.Delete(fileAttributeFullPath + ViewState["FieldValueString"].ToString()); } catch { } dictionary[Column.Name] = fileName; } if (DeleteCheckBox.Checked) dictionary[Column.Name] = null; }
give that a try.
sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Custom Delete
Feb 19, 2012 05:06 PM|LINK
OK I woudl add a checkbox to the Field_Edit.ascx file
then in the ExtractValues method check the checkbox if set set the dictionary to null this will null the value
give that a try.
Always seeking an elegant solution.