[Html 부분]
<DIV id = "GridDiv" runat = "server">
[cs부분]
protected System.Web.UI.HtmlControls.HtmlGenericControl GridDiv; //GridDiv 변수를 선언
DataSet ds = new DataSet();
//DataSet에 조회된 내용의 유무에 따라 스타일을 다르게 적용한다.
//있다면 WIDTH: 790px; HEIGHT: 480px
//없다면 WIDTH: 100%; HEIGHT: 100%
if( ds.Tables[0].Rows.Count > 0 )
{
else
{
//적용할 스타일 속성
string Attributes = "WIDTH: 100%; HEIGHT: 100%; ....";
GridDiv.Attributes.Add( "style", Attributes );
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
}
<DIV id = "GridDiv" runat = "server">
[cs부분]
protected System.Web.UI.HtmlControls.HtmlGenericControl GridDiv; //GridDiv 변수를 선언
DataSet ds = new DataSet();
//DataSet에 조회된 내용의 유무에 따라 스타일을 다르게 적용한다.
//있다면 WIDTH: 790px; HEIGHT: 480px
//없다면 WIDTH: 100%; HEIGHT: 100%
if( ds.Tables[0].Rows.Count > 0 )
{
//적용할 스타일 속성
string Attributes = "WIDTH: 790px; HEIGHT: 480px; ....";
GridDiv.Attributes.Add( "style", Attributes );
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
else
{
//적용할 스타일 속성
string Attributes = "WIDTH: 100%; HEIGHT: 100%; ....";
GridDiv.Attributes.Add( "style", Attributes );
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
}