From: JohnE on
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



From: JohnE on
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
>
>
>