Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Drop a label on your target form like this:</p> <pre><code>&lt;asp:label ID="Label1" runat="server" text="Label"&gt;&lt;/asp:label&gt; </code></pre> <p>Go to code behind of the target page find method <code>Page_Load</code> and add following code:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { Label1.Text = (string) Session["sesionicontrol"]; } </code></pre> <p>This will read the value of <code>login.NombreUsuario</code> hich was saved previously into <code>Session["sesionicontrol"]</code> and display it in label.</p> <p>Assuptions I made are that:</p> <ol> <li><code>login.NombreUsuario</code> - contains the data you are reffering as user name - and that's what you want to pass along.</li> <li>it is of type <code>string</code>.</li> </ol> <hr> <p>Generally <code>Session</code> privides a dictionary to save any named objects. They are shared between all pages inside current session. You can use session to pass some data across pages like this:</p> <p><strong>WebForm1.aspx</strong></p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /&gt; </code></pre> <p><strong>WebForm1.aspx.cs</strong></p> <pre><code> protected void Button1_Click(object sender, EventArgs e) { Session["SomeKey"] = TextBox1.Text; Response.Redirect("WebForm2.aspx"); } </code></pre> <p>This saves the value you have just entered in <code>TextBox</code> into session.</p> <p><strong>WebForm2.aspx</strong></p> <pre><code>&lt;asp:label ID="Label1" runat="server" text="Label"&gt;&lt;/asp:label&gt; </code></pre> <p><strong>WebForm2.sapx.cs</strong></p> <pre><code>public partial class WebForm2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label1.Text = (string) Session["someKey"]; } } </code></pre> <p>This fetches the values you have stored in previous page uner key <code>SomeKey</code> and sets it to <code>Label</code> before the page gets rendered. You see the text you have entered on the forst page.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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