nested gridview


J

JohnE

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
 
Ad

Advertisements


Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top