using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace KstCmsBase.WebPage
{
    public class FrmControl:ValidationPage
    {
        protected void Set_Control(string[] Attribstr, params Object[] MyObject)
        {
            if (!ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "CheckForm"))
            {
                Page.ClientScript.RegisterClientScriptInclude("CheckForm", SysRootUrl + "/KstCMS_Manager/JavaScript/CheckForm.js");

            }
            if (!ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "Data_Selector"))
            {
                Page.ClientScript.RegisterClientScriptInclude("Data_Selector", SysRootUrl + "/KstCMS_Manager/Module/Data_Selector/popcalendar.js");
                Label lb = new Label();
                lb.Text = "<link type=\"text/css\" rel=\"Stylesheet\" href=\"" + SysRootUrl + "/KstCMS_Manager/Module/Data_Selector/popcalendar.css\" /><script language=\"javascript\" type=\"text/javascript\">var imgDir='" + SysRootUrl + "/module/Data_Selector/';</script>";

                Page.Header.Controls.Add(lb);
            }

            int ObjCount = MyObject.Length;
            if (ObjCount > 0)
            {
                for (int i = 0; i < ObjCount; i++)
                {
                    string ControlsType = MyObject[i].GetType().Name;

                    switch (ControlsType)
                    {
                        case "TextBox":
                            {
                                ((TextBox)MyObject[i]).Attributes.Add("title", Attribstr[i]);
                                break;
                            }
                        case "DropDownList":
                            {
                                ((DropDownList)MyObject[i]).Attributes.Add("title", Attribstr[i]);

                                break;

                            }


                    }
                }
            }
        }
    }
}
