Deleting files from the Datagrid

Results 1 to 2 of 2

Thread: Deleting files from the Datagrid

  1. #1
    Join Date
    Dec 1969

    Default Deleting files from the Datagrid

    Hi <BR><BR>I am referring to the article at regarding the deletion of files from the datagrid from a speicifc folder.<BR><BR>I think the code here only does a demo on deleting files, how do I go about changing to actually delete the files from the datagrid? I think it has something to do with this line of code: File.Delete(fileName)<BR><BR>Thanks, any help would be really appreciated<BR><BR>Chris

  2. #2
    Join Date
    Dec 1969

    Default RE: Deleting files from the Datagrid

    just like the code says:<BR>[code language="VB.NET"] lblMessage.Text = "You opted to delete the file " & fileName & ".&#060;br /&#062;" & _<BR> "This file could be deleted by calling: &#060;code&#062;File.Delete(fileName)&#060;/code&#062;&#060;p&#062;"<BR> <BR> &#039;You would want to rebind the Directory&#039;s files to the DataGrid after<BR> &#039;deleting the file...<BR>[/code]<BR>so, you&#039;d have a line in the event:<BR>[code language="VB.NET"]File.Delete(fileName)[/code]<BR>and it also mentions rebinding the grid, so you&#039;d mimic what the page does on Page_Load with no postback<BR>[code language="VB.NET"]Dim dirInfo as New DirectoryInfo(Server.MapPath(""))<BR>articleList.D ataSource = dirInfo.GetFiles("*.aspx")<BR>articleList.DataBind ()<BR>[/code]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts