<asp:DataGrid id=TMediaDataGrid>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DataGrid id=TLTextDataGrid DataSource="<%# Tutorial_TextTB(MedKey)%>">
</asp:DataGrid>其中MedKey为外层DATAGRID的DataKeyField值,急等如何取得
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DataGrid id=TLTextDataGrid DataSource="<%# Tutorial_TextTB(MedKey)%>">
</asp:DataGrid>其中MedKey为外层DATAGRID的DataKeyField值,急等如何取得
private void TMediaDataGrid_ItemDataBound(...)
{
if(e.Item.ItemIndex>-1)
{
string curID = e.Item.Cells[0].Text; DataGrid dg = e.Item.FindControl("TLTextDataGrid ") as DataGrid;
dg.DataSource = ..;
dg.DataBind();
}
}
<asp:DataGrid DataSource="<%# Tutorial_TextTB(Container.ItemIndex)%>">
public DataTable Tutorial_TextTB(int ParID)//根据父节点主键获取子节点内容
{
DataTable Tutorial_MediaTB = (new BLLTutorial_Media()).GetTutorial_Media_By_TLEID(Int32.Parse(Request.QueryString["TLEID"]));//调用父节点应用层
DataRow row = Tutorial_MediaTB.Rows[ParID];
string TMediaID=row[ComTutorial_Media.TMediaID_FIELD].ToString();
DataTable Tutorial_TextTB = (new BLLTutorial_Text()).GetBLLTutorial_Text_By_TMediaID(Int32.Parse(TMediaID));//
return Tutorial_TextTB;
}