November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
I'm triggering DeleteClick in my UserControl and how do I pass the object (comment) to the Delete method?
In UserControl:
protected void DeleteClick(object sender, EventArgs e)
{ Comments.Delete(?); }
Delete in Comments class:
public static void Delete(Comments comment) { // Create a data store (but only if one doesn't exist, we won't overwrite an existing one) var store = DynamicDataStoreFactory.Instance.CreateStore(typeof(Comments)); // Delete the specified comment store.Delete(comment.Id); }
You should bind the comment Id to the comment control, and when user clicks "delete", you can get back the Id and delete it. You don't have to submit the comment object to the function.
Thank you! Yes, I managed to solve it like this:
In UserControl:
protected void DeleteClick(object sender, CommandEventArgs args) { Comments.Delete(args.CommandArgument.ToString()); ListaKommentarer(); }
In Comments class:
public static void Delete(String id) { // Create a data store (but only if one doesn't exist, we won't overwrite an existing one) var store = DynamicDataStoreFactory.Instance.CreateStore(typeof(Comments)); store.Delete(Identity.Parse(id)); }
Hi!
I've been testing Dynamic Data Store for the first time following this guide:
http://roland.kierkels.net/episerver/storing-data-using-episerver-7-5-dynamic-data-store/
I have run into problems when trying to delete a post. I have this method in my class (Comments):
I have also created a UserControl (Comment) which contains a simple form for adding posts and displaying them. It works... I would also like to add a "Delete" button to each post which should of course delete the post. So I would like to call the method Delete from the UserControl. I just can't figure out how to send the whole object to the method. At the moment I'm using asp:LinkButton which triggers DeleteClick:
Thankful for help!