Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could certainly use the query string to pass data to your List.aspx page, but be careful passing text that you're planning on writing out in the HTML - you'll need to protect against XSS attacks.</p> <p>There are several other ways to do this. Chances are, you're going to have several places in your application where you want to redirect the user to another page, but also display a message that has something to do with what they did on the previous page (saved an item, deleted an item, etc.). It would be better to come up with more of a global scheme for this rather than a one-off just for this particular instance.</p> <p>One idea is to use the Session for storing a message, then do your redirect.</p> <pre><code>Session("Message") = "Item was added to list." Response.Redirect("List.aspx") </code></pre> <p>Then, on your pages (or a Master Page, perhaps), you check <code>Session("Message")</code> and if it's got something, you show that message to the user, then clear that variable.</p> <pre><code>If Session("Message") IsNot Nothing Then Response.Write(CType(Session("Message"), String)) 'or set a label text, or show a pop up div, or whatever' Session("Message") = Nothing End If </code></pre> <p>If you use this approach, I recommend you write a helper class, and just use that to manage your messaging:</p> <pre><code>MessageHelper.SetMessage("Item added to list.") </code></pre> <p>and</p> <pre><code>MessageHelper.GetMessage() </code></pre> <p>would be the methods you would need.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload