using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using BoyunBase;
using SiteCore;

public partial class Part_HtmlView : System.Web.UI.UserControl
{
    protected void Page_Load( object sender, EventArgs e )
    {
        try {
            if( IsPostBack ) return;
            string cont = "";

            PartAccess pAcs = new PartAccess( this );
            if( pAcs.IsReady ) {
                cont = pAcs.GetSetting( "HtmlContent" );
                if( cont != "" ) {
                    Todo.DebugOut( "Part_HtmlView 读取到设置数据" );
                    ltrHtmlShow.Text = cont;
                    return;
                }
            }

            ContentAccess ca = new ContentAccess( this, "TableName" );
            DataTable dt = ca.Read( "[*].(HyperCont)", "name" );
            if( dt != null && dt.Rows.Count > 0 ) {
                 cont = dt.Rows[0]["HyperCont"].ToString();
                if( cont != "" ) {
                    Todo.DebugOut( "Part_HtmlView 读取到绑定数据" );
                    ltrHtmlShow.Text = cont;
                    return;
                }
            }

        } catch( Exception ex ) {
            Todo.DebugOut( "加载 Part_HtmlView 出现异常：" + ex.Message );
        }
    }
}
