Пример #1
0
        protected override void OnAjaxPreRender()
        {
            base.OnAjaxPreRender();

            StringBuilder sb = new StringBuilder();

            if (PropertyModified("SelectedDate"))
            {
                sb.AppendFormat("{0}.setValue({1});", XID, ExtDateTimeConvertor.GetExtDateObject(SelectedDate.Value));
            }

            AddAjaxScript(sb);
        }
Пример #2
0
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();


            // extjs 的日期格式化字符串
            string extjsDateFormatString = ExtDateTimeConvertor.ConvertToExtDateFormat(DateFormatString);

            OB.AddProperty("format", extjsDateFormatString);

            //if (EnableChineseAltFormats)
            //{
            //    OB.AddProperty("altFormats", "Y-m-d|Y-n-j|Ymd|Ynj|y-m-d|y-n-j|ymd|ynj");
            //}

            if (SelectedDate != null)
            {
                OB.AddProperty("value", ExtDateTimeConvertor.GetExtDateObject(SelectedDate.Value), true);
            }

            if (MaxDate != null)
            {
                OB.AddProperty("maxDate", ExtDateTimeConvertor.GetExtDateObject(MaxDate.Value), true);
            }

            if (MinDate != null)
            {
                OB.AddProperty("minDate", ExtDateTimeConvertor.GetExtDateObject(MinDate.Value), true);
            }


            if (EnableDateSelect)
            {
                OB.Listeners.AddProperty("select", JsHelper.GetFunction(GetPostBackEventReference("Select")), true);
            }


            string jsContent = String.Format("var {0}=new Ext.DatePicker({1});", XID, OB.ToString());

            AddStartupScript(jsContent);
        }