Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6827537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:16:38+00:00 2026-05-26T22:16:38+00:00

I’m trying to nest two Grid_Views like … <asp:GridView ID=gv runat=server CellPadding=0 ForeColor=#333333 GridLines=None

  • 0

I’m trying to nest two Grid_Views like …

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

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


                    </asp:GridView>
                    <asp:SqlDataSource ID="innerrecs" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:TimeMatters10ConnectionString %>" 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">
                        <SelectParameters>
                            <asp:SessionParameter Name="conno" SessionField="@conno" />
                        </SelectParameters>
                    </asp:SqlDataSource>

                If You have Any Questions in Reference to this matter please do not hesitate ot contact me.<br /><br />
                Thank You,<br />
                Dara
            <br clear="all" style="page-break-before:always" />
            </ItemTemplate>
        </asp:TemplateField>                
    </Columns>
</asp:GridView>
    <asp:SqlDataSource ID="groupby" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TimeMatters10ConnectionString %>" 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', '')">
    </asp:SqlDataSource>

Basically I want to pass the value “conno” from the Outer Grid to the Inner Grid. I tried

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;
}

But this is no good, what is the correct way to do this ?. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:16:38+00:00Added an answer on May 26, 2026 at 10:16 pm

    Try following approach (not tested): add DataKeyNames property to the outer gridView and set it to con_no value. Change parameter for nested sqldatasource from SessionParameter to Parameter and rewrite RowBound method as below:

    protected void RowBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var innerrecs = e.Row.FindControl("innerrecs") as SqlDataSource;
    
            innerrecs.SelectParameters["conno"].DefaultValue = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
    
            var gridView1 = e.Row.FindControl("GridView1") as GridView;
    
            gridView1.DataBind();
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.