コンテンツページにデータを含むグリッドビューがあります.マスターページボタンクリックでグリッドビューのデータソースをデータテーブルとして取得する必要があります.followingは私のコードです
string DicPageName = Page.GetType().Name;
GridView gv1;
DataTable DT;
if (DicPageName == "dictionaries_abs_aspx")
{
gv1 = (GridView)ContentPlaceHolder2.FindControl("GridView1");
if (gv1 != null)
{
if (gv1.Visible)
{
DT = new DataTable();
DT = (DataTable)gv1.DataSource;
}
}
}
しかし、DT は null.plz ヘルプを返します