ASPX templates
Version 4.x > ASPX templates > Delete a document via Gridview View modes: 
User avatar
Member
Member
darrenhdg-gmail - 7/23/2009 6:10:39 AM
   
Delete a document via Gridview
I have set up an aspx page with a gridview component to show a list of documents, which works fine. I want to be able to delete documents not only from the database but also from the CMS Tree.

I put in some code behind (taken from the documentation on deleting documents) on the delete button which works but obviously just deletes the whole contents of the document node I'm pointing it at. How can I get the information to only delete the document selected in the gridview component? Or am I better off not using gridview and writing something from scratch?

Cheers.

User avatar
Kentico Developer
Kentico Developer
kentico_zbysekn - 7/28/2009 3:47:29 PM
   
RE:Delete a document via Gridview
Hi Darren,
I'm maybe wrong but gridview is often used to call delete on some datasource object, but what you need is to specify some method or code which will use our API to get rid of the document. In this case I think that using of our unigrid control will be much better.
It uses xml template determine its layout. You can find nice example of UniGrid connected with deleting documents using our API in ~\CMSDesk\Content\listing.aspx and related files, so I suggest you to use very similar code to achieve mentioned functionality.
Best Regards,
Zbysek Nemec.

User avatar
Member
Member
darrenhdg-gmail - 7/30/2009 11:23:03 AM
   
RE:Delete a document via Gridview
Thanks Zbysek, I'll check it out.