nested gridview

Discussion in 'ASP .Net' started by JohnE, Mar 5, 2010.

  1. JohnE

    JohnE Guest

    I am working on nesting a gridview in a gridview and taking it one step at a
    time. So far, so good. But now I have hit a snag in filling the nested
    gridview. Here is the code that I am using (or trying to use).

    protected void gvwChangeRequestList_RowDataBound(object sender,
    GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    GridView nested = e.Row.FindControl("gvwChangeRequestChildren");
    SqlDataSource dbSrc = new SqlDataSource();
    dbSrc.ConnectionString =
    ConfigurationManager.ConnectionStrings("ProteusConnectionString").ConnectionString;
    dbSrc.SelectCommand = "SELECT ChangeRequestID, ChangeRequest,
    DevTargetEndDate FROM tblChangeRequest WHERE IsChildOf = '" +
    e.Row.DataItem("ChangeRequestID").ToString + "' ORDER BY ChangeRequestID";

    nested.DataSource = dbSrc;
    nested.DataBind();
    }
    }

    This was originally VB and I need to go to C# and my converting is not going
    well. I am getting error on the following lines;

    1) GridView nested = e.Row.FindControl("gvwChangeRequestChildren"); with
    the error coming on the e.Row...

    2) dbSrc.ConnectionString =
    ConfigurationManager.ConnectionStrings("ProteusConnectionString").ConnectionString; with error on .ConnectionStrings

    3) dbSrc.SelectCommand = "SELECT ChangeRequestID, ChangeRequest,
    DevTargetEndDate FROM tblChangeRequest WHERE IsChildOf = '" +
    e.Row.DataItem("ChangeRequestID").ToString + "' ORDER BY ChangeRequestID";
    with the error on the DataItem

    If someone is proficient in converting this properly, please help.

    Thanks...John
     
    JohnE, Mar 5, 2010
    #1
    1. Advertising

  2. JohnE

    JohnE Guest

    Nevermind. Figured it out.



    "JohnE" wrote:

    > I am working on nesting a gridview in a gridview and taking it one step at a
    > time. So far, so good. But now I have hit a snag in filling the nested
    > gridview. Here is the code that I am using (or trying to use).
    >
    > protected void gvwChangeRequestList_RowDataBound(object sender,
    > GridViewRowEventArgs e)
    > {
    > if (e.Row.RowType == DataControlRowType.DataRow)
    > {
    > GridView nested = e.Row.FindControl("gvwChangeRequestChildren");
    > SqlDataSource dbSrc = new SqlDataSource();
    > dbSrc.ConnectionString =
    > ConfigurationManager.ConnectionStrings("ProteusConnectionString").ConnectionString;
    > dbSrc.SelectCommand = "SELECT ChangeRequestID, ChangeRequest,
    > DevTargetEndDate FROM tblChangeRequest WHERE IsChildOf = '" +
    > e.Row.DataItem("ChangeRequestID").ToString + "' ORDER BY ChangeRequestID";
    >
    > nested.DataSource = dbSrc;
    > nested.DataBind();
    > }
    > }
    >
    > This was originally VB and I need to go to C# and my converting is not going
    > well. I am getting error on the following lines;
    >
    > 1) GridView nested = e.Row.FindControl("gvwChangeRequestChildren"); with
    > the error coming on the e.Row...
    >
    > 2) dbSrc.ConnectionString =
    > ConfigurationManager.ConnectionStrings("ProteusConnectionString").ConnectionString; with error on .ConnectionStrings
    >
    > 3) dbSrc.SelectCommand = "SELECT ChangeRequestID, ChangeRequest,
    > DevTargetEndDate FROM tblChangeRequest WHERE IsChildOf = '" +
    > e.Row.DataItem("ChangeRequestID").ToString + "' ORDER BY ChangeRequestID";
    > with the error on the DataItem
    >
    > If someone is proficient in converting this properly, please help.
    >
    > Thanks...John
    >
    >
    >
     
    JohnE, Mar 5, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russ Perry Jr
    Replies:
    2
    Views:
    4,237
    Russ Perry Jr
    Aug 20, 2004
  2. H5N1
    Replies:
    0
    Views:
    2,751
  3. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,021
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  4. Chad E. Dollins
    Replies:
    3
    Views:
    673
    Kai-Uwe Bux
    Nov 8, 2005
  5. HeavyMetal

    GridView RowCommand problem: GridView Nested in Repeater

    HeavyMetal, Aug 8, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    901
    HeavyMetal
    Aug 8, 2006
Loading...

Share This Page