Selecting session variable with an IF statement
<p>I have this code to send variables to a datagrid on another page</p>

<pre><code> protected void Button1_Click(object sender, EventArgs e)
    {
        int agent = int.Parse(txtAgencyCode.Text);
        Session["para1"] = agent;
        Button1.Attributes.Add("onclick", "window.open('http://localhost:50771/WebSite4/Datagrid.aspx'); return false;");

    }

    protected void btnTitleSearch_Click(object sender, EventArgs e)
    {
        Session["para2"] = txtTitleSearch.Text;
        btnTitleSearch.Attributes.Add("onclick", "window.open('http://localhost:50771/WebSite4/Datagrid.aspx'); return false;");
    }
</code></pre>

<p>and this code on the other page that uses the session variable from button one</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
    {
        int field1 = (int)(Session["para"]);
        localhost.Service ws = new localhost.Service();
        GridView1.DataSource = ws.GetJobsByAgencyID(field1);
        GridView1.DataBind();
    }
</code></pre>

<p>What i cannot figure out is how to make an if statement (or even if it will be an if statement that is used) to decide which parameter is passed to my datagrid. </p>

<p>For info there will be another 3- 4 controlos on the default page (Only one of which will be activated) and the parameters will take diffeent types.</p>

<p><strong>EDIT</strong>
So sorry you all found my question hard to understand, im not by any means a profesional or even what yuo may call a competent. 
James Hill and Ravi gave me pretty much what I was after (need to test but looks like it). Thanks all for trying :D</p>
