qs_postback.aspx 709 B

1234567891011121314151617181920212223242526272829303132
  1. <%@ Page Language="C#" AutoEventWireup="True" %>
  2. <html>
  3. <head>
  4. <script runat="server">
  5. void Page_Load (object o, EventArgs e)
  6. {
  7. DataBind ();
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <p>
  13. Instructions: put a query string (ie ...aspx?a=b) in the
  14. location bar. Then click the button. You should get the same
  15. query string on the resulting page.
  16. </p>
  17. <form runat="server">
  18. <asp:button runat="server" Text="Click Me!"/>
  19. <br>
  20. Your query string:<br>
  21. <asp:DataList id="DataList1" DataSource="<%# Request.QueryString %>" runat="server">
  22. <ItemTemplate>
  23. <%# Container.DataItem %> -- <%# Request.QueryString [(string) Container.DataItem] %>
  24. </ItemTemplate>
  25. </asp:datalist>
  26. </form>
  27. </body>
  28. </html>