using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using BoyunBase;
using SiteCore;

public partial class Part_PicSlide_F : System.Web.UI.UserControl
{

    protected void Page_Load( object sender, EventArgs e )
    {
        try {
            if( IsPostBack ) return;

            ContentAccess ca = new ContentAccess( this, "TableName" );
            DataTable dt = ca.Read( "[*]", "name" );
            if( dt == null || dt.Rows.Count < 1 ) return;

            StringBuilder script = new StringBuilder( 256 );
            script.AppendLine( "<script language=\"JavaScript\" type=\"text/javascript\" >" );
            script.AppendLine( "var xb;" );
            script.AppendLine( "var pics='';" );
            script.AppendLine( "var links='';" );
            script.AppendLine( "var texts='';" );
            script.AppendLine( "var imgUrl=new Array();" );
            script.AppendLine( "var imgLink=new Array();" );
            script.AppendLine( "var imgText=new Array();" );
            script.AppendLine( "var order = new Array('', '1', '2', '3');" );
            //读数据
            DataRow dr = null;
            string linkUrl, imageUrl, noteText;
            for( int i = 0; i < dt.Rows.Count; i++ ) {
                dr = dt.Rows[i];
                linkUrl = Todo.Get( "linkUrl", dr ); if( linkUrl == "" ) linkUrl = "#";
                imageUrl = Todo.Get( "imageUrl", dr );
                noteText = Todo.Get( "noteText", dr );
                script.AppendLine( "imgLink[" + (i + 1) + "]='" + linkUrl + "';" );
                script.AppendLine( "imgUrl[" + (i + 1) + "]='" + imageUrl + "';" );
                script.AppendLine( "imgText[" + (i + 1) + "]='" + noteText + "';" );
            }
            script.AppendLine( "</script>" );
            ltrScript.Text = script.ToString();

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