الخميس، 21 يوليو 2011

ASP.NET Nested GridView

Steps
1.    Add gridview to page and then configure Data Source

1.    Click next then Ok
2.    Add new Data template to insert nested gridview into it.


1.    Click next then Ok
2.    Add new Data template to insert nested gridview into it.

1.    Then click on Edit template to add gridview

1.    Then configure the inside grid view with data Source.

1.    End Edit template and go to cs code.

protected void OutSidegeidView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

    SqlDataSource s =(SqlDataSource)e.Row.FindControl("SqlDataSource2");

s.SelectParameters[0].DefaultValue=((DataRowView)e.Row.DataItem)["id"].ToString();
        }
       
    }



















0 التعليقات: