Gridview Item Template Pass Value from Outer Grid to Inner Grid
<p>I'm trying to nest two Grid_Views like ... </p>

<pre><code> &lt;asp:GridView ID="gv" runat="server" CellPadding="0" ForeColor="#333333" 
        GridLines="None" AutoGenerateColumns="False" Width="100%" 
        DataSourceID="groupby" OnRowDataBound="RowBound"&gt;
    &lt;Columns&gt;
        &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;

                    &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="innerrecs"&gt;
                        &lt;Columns&gt;
                            &lt;asp:BoundField DataField="date" HeaderText="date" ReadOnly="True" 
                                SortExpression="date" /&gt;
                            &lt;asp:BoundField DataField="mat_no" HeaderText="mat_no" 
                                SortExpression="mat_no" /&gt;
                            &lt;asp:BoundField DataField="injur" HeaderText="injur" SortExpression="injur" /&gt;
                            &lt;asp:BoundField DataField="clm bal" HeaderText="clm bal" 
                                SortExpression="clm bal" /&gt;
                            &lt;asp:BoundField DataField="DOA" HeaderText="DOA" SortExpression="DOA" /&gt;
                            &lt;asp:BoundField DataField="county" HeaderText="county" ReadOnly="True" 
                                SortExpression="county" /&gt;
                        &lt;/Columns&gt;


                    &lt;/asp:GridView&gt;
                    &lt;asp:SqlDataSource ID="innerrecs" runat="server" 
                        ConnectionString="&lt;%$ ConnectionStrings:TimeMatters10ConnectionString %&gt;" SelectCommand="SELECT CONVERT(CHAR,DATEADD(D, [event].[date], '1800-12-28'),101) as 'date', 
                            [event].mat_no, matter.mat1_01_07 as 'injur', matter.mat1_07_01 as 'clm bal', MAT1_03_08 as 'DOA',replace(matter.mat1_05_03, 'COUNTY OF ', '') as 'county'
                            FROM lntmuser.[event]
                            INNER JOIN lntmuser.matter
                            ON lntmuser.matter.sysid = lntmuser.[event].mat_id
                            INNER JOIN lntmuser.matter2
                            ON lntmuser.matter2.sysid = lntmuser.[event].mat_id
                            WHERE DateDiff(month, Convert(date, CONVERT(CHAR,DATEADD(D, [event].[date], '1800-12-28'),101), 101), GETDATE()) = 1
                            AND event.con_no = @conno
                            order by matter.client"&gt;
                        &lt;SelectParameters&gt;
                            &lt;asp:SessionParameter Name="conno" SessionField="@conno" /&gt;
                        &lt;/SelectParameters&gt;
                    &lt;/asp:SqlDataSource&gt;

                If You have Any Questions in Reference to this matter please do not hesitate ot contact me.&lt;br /&gt;&lt;br /&gt;
                Thank You,&lt;br /&gt;
                Dara
            &lt;br clear="all" style="page-break-before:always" /&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;                
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;
    &lt;asp:SqlDataSource ID="groupby" runat="server" 
        ConnectionString="&lt;%$ ConnectionStrings:TimeMatters10ConnectionString %&gt;" SelectCommand="SELECT MAX(event.[con_no]) as 'con_no', replace(replace(replace([matter].client, 'P.C.', ''), 'PC', ''), 'INC', '') as 'client',
        MAX(mat1_02_02) as 'BillSup', MAX(mat1_02_09) as 'Fax'
        , CONVERT(char, GETDATE(), 101) as 'DT'
        FROM lntmuser.[event]
        INNER JOIN lntmuser.matter
        ON lntmuser.matter.sysid = lntmuser.[event].mat_id
        INNER JOIN lntmuser.matter2
        ON lntmuser.matter2.sysid = lntmuser.[event].mat_id
        WHERE DateDiff(month, Convert(date, CONVERT(CHAR,DATEADD(D, [event].[date], '1800-12-28'),101), 101), GETDATE()) = 1
        GROUP BY replace(replace(replace([matter].client, 'P.C.', ''), 'PC', ''), 'INC', '')"&gt;
    &lt;/asp:SqlDataSource&gt;
</code></pre>

<p>Basically I want to pass the value "conno" from the Outer Grid to the Inner Grid.  I tried </p>

<pre><code>protected void RowBound(object sender, GridViewRowEventArgs e)
{
    //string conno = ((DataBoundLiteralControl)e.Row.Cells[0].Controls[1]).Text;
    //string conno = DataBinder.Eval(e.Row.DataItem, "con_no").ToString();
    Session["conno"] = conno;
}
</code></pre>

<p>But this is no good, what is the correct way to do this ?.  Thanks</p>
