Passing values in a URL string
<p>I have the following code</p>

<pre><code> &lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/    TR/    x    html1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;Oncall Lookup&lt;/title&gt;

&lt;style type="text/css"&gt;
    .style1
    {
        text-align: center;
    }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;

    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;

&lt;/div&gt;
&lt;div class="style1"&gt;
    &amp;nbsp;&lt;asp:Label ID="TimeDateLabel" runat="server" style="text-align: center"&gt;&lt;/asp:Label&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;


        &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
        &lt;asp:TextBox ID="schednameTextBox" runat="server" style="text-align: center"&gt;&lt;/    asp:TextBox&gt;
    &lt;asp:RequiredFieldValidator ID="schednameValidator" runat="server" 
        ControlToValidate="schednameTextBox" ErrorMessage="This is a required field"&gt;This 
    is a required field&lt;/asp:RequiredFieldValidator&gt;
    &lt;br /&gt;
    Schedule Name&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;asp:TextBox ID="sincedateTextBox" runat="server" style="text-align: center"&gt;&lt;/asp:TextBox&gt;
    &lt;asp:RequiredFieldValidator ID="sincedateValidator" runat="server" 
        ControlToValidate="sincedateTextBox" ErrorMessage="This is a required field"&gt;This 
    is a required field&lt;/asp:RequiredFieldValidator&gt;
    &lt;br /&gt;
    Since Date&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;asp:Button ID="whosoncallButton" runat="server" Text="Who's On Call" /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;asp:Button ID="clearButton" runat="server" Text="Clear" /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
        &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"      HorizontalAlign="Center"
        DataSourceID="SqlDataSource1"&gt;
        &lt;Columns&gt;
            &lt;asp:BoundField DataField="SchedName" HeaderText="SchedName" 
                SortExpression="SchedName" /&gt;
            &lt;asp:BoundField DataField="ActivityDate" HeaderText="ActivityDate" 
                ReadOnly="True" SortExpression="ActivityDate" /&gt;
            &lt;asp:BoundField DataField="By" HeaderText="By" SortExpression="By" /&gt;
            &lt;asp:BoundField DataField="Activity" HeaderText="Activity" ReadOnly="True" 
                SortExpression="Activity" /&gt;
           &lt;asp:TemplateField HeaderText="Firstlisting" SortExpression="Firstlisting"&gt; 
        &lt;ItemTemplate&gt; 
            &lt;asp:HyperLink ID="Firstlisting" runat="server" Text='&lt;%# Eval("Firstlisting") %&gt;' 
                NavigateUrl='&lt;%# String.Format("\website1\Default3.aspx?firstlisting={0}", Eval("Firstlisting")) %&gt;' /&gt; 
&lt;/ItemTemplate&gt; 
&lt;/asp:TemplateField&gt;   
            &lt;asp:TemplateField HeaderText="OncallStart" SortExpression="OnCallStart"&gt; 
&lt;ItemTemplate&gt; 
    &lt;asp:HyperLink ID="OnCallStart" runat="server" Text='&lt;%# Eval("OncallStart") %&gt;' 
         NavigateUrl='&lt;%# String.Format("\website1\Default2.aspx?date={0}&amp;schedname={1}", Eval("OncallStart"), Eval("Schedname")) %&gt;' /&gt; 
&lt;/ItemTemplate&gt; 
&lt;/asp:TemplateField&gt;   
            &lt;asp:BoundField DataField="OnCallEnd" HeaderText="OnCallEnd" ReadOnly="True" 
                SortExpression="OnCallEnd" /&gt;
        &lt;/Columns&gt;
    &lt;/asp:GridView&gt;
    &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="&lt;%$ ConnectionStrings:MDRConnectionString %&gt;" 
        SelectCommand="sp_getoncallresults2" SelectCommandType="StoredProcedure"&gt;
        &lt;SelectParameters&gt;
            &lt;asp:ControlParameter ControlID="sincedateTextBox" DbType="Datetime" 
                Name="sincedate" PropertyName="Text" /&gt;
            &lt;asp:ControlParameter ControlID="schednameTextBox" Name="schedname" 
                PropertyName="Text" Type="String" /&gt;
        &lt;/SelectParameters&gt;
    &lt;/asp:SqlDataSource&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;asp:Label ID="nodataLabel" runat="server"&gt;&lt;/asp:Label&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>
</p>

<p>and when I try to pass certain variables to my next page, they're not being passed. I was told that I'm not accounting for ampersands and blacks in my URL string. What is the best way to do that? </p>

<p>Thank you</p>

<p>Doug</p>
