以下のように、1つのページにグリッドビューを配置したい
<asp:GridView ID="gvDoctorList" runat="server" 
           AutoGenerateColumns="False" 
           DataSourceID="SqlDataSource1" 
           AllowPaging="True" 
           AllowSorting="True" 
           AutoGenerateEditButton="true" 
           AutoGenerateDeleteButton="true">
     <Columns>
         <asp:TemplateField>
              <ItemTemplate>
                   <asp:CheckBox runat="server" 
                                 ID="chk" 
                                 OnCheckedChanged="chk_CheckedChanged"
                                 AutoPostBack="true"/>
                   <asp:Label runat="server" ID="lblPID" Visible="false" Text='<%# Eval("PatientId") %>'></asp:Label>
              </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField DataField="PatientId" 
                         HeaderText="PatientId" 
                         SortExpression="PatientId" />
         <asp:BoundField DataField="firstname" 
                         HeaderText="firstname" 
                         SortExpression="firstname" />
         <asp:BoundField DataField="lastname" 
                         HeaderText="lastname" 
                         SortExpression="lastname" />
          <asp:BoundField DataField="sex" 
                         HeaderText="sex" 
                         SortExpression="sex" />
     </Columns>
  </asp:GridView>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                     ConnectionString="<%$ ConnectionStrings:MyDatabaseConnectionString %>"  
                     SelectCommand="SELECT [PatientId],[firstname], [lastname], [sex] FROM [PatientDetails]">
  </asp:SqlDataSource>
以下のように、チェックボックスの変更イベントにセッションを配置します
 protected void chk_CheckedChanged(object sender, EventArgs e)
 {
         GridViewRow row = ((GridViewRow)((Control)sender).Parent.Parent);
        string requestid =  gvDoctorList.DataKeys[row.RowIndex].Value.ToString();
        string cellvalue = row.Cells[1].Text;
        Session["pId"] = cellvalue;   
             }
別のページでセッションの値を取得したいので、次のように別のページで何かをしました
protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["pId"] != null)
        {
            lblsession.Text = Session["pId"].ToString();
        }
        else 
        { 
        }
    }
しかし、問題は、チェックボックスの変更イベント、特にセッション行でコードをデバッグすると、オブジェクト参照がオブジェクトのインスタンスに設定されていないというエラーが表示されることです。
私は何が間違っているのか理解できませんか?
私がやりたいことは、ユーザーがチェックボックスをオンにしているグリッドビューから患者IDの値を取得することです....選択した値を別のページに送信し、患者IDをSQLテーブルに挿入します。
コーディングまたは別の良いアイデアの例を提供してください。