Friday 15 April 2011

asp.net - Best way to refresh page -


OK, I have a hyperlink on my page and it is organized in hyperlink user control. When a user clicks on that link, then it is used to remove an item on the page, so:

  & lt; A href = '& lt;% # string.format ("{0}? RemoveItem = true & amp; itemID = {1}", current page, container.datetime.ind)% & gt; 'Gt; Remove this item & lt; / A & gt;  

On the click of the link, my user checks for the code-back of the control and checks for ITem bool and if set to true, then that item is deleted: < / P>

  RemoveSavedItem = Convert.ToBoolean (Request ["removeItem"]); If (removeItem) RemoveItem ();  

And here is my RemoveItem () method:

  Protected Zero RemovItem () {int itemID = Util.ParamVal ("savedItemID", 0); If (item id> 0) service RemoveItem (itemID); }  

But I need my page to refresh because it is removing it but my repeater is not showing the list with the item being removed, what is the best way to approach this is? Just make a rebound of the repeater or is there a cleaner way? Maybe it's just the standard way? Can I return it after removing it in this method?

I prefer to redirect back to the same page.

Feedback Redirect (Request.Path);

No comments:

Post a Comment