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); }
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); }
protected override void OnFirstPreRender() { base.OnFirstPreRender(); // 日期选择器也需要菜单组件的支持 ResourceManager.Instance.AddJavaScriptComponent("menu"); // 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"); } //// 当前选中的日期值,这个在父类中已经设置了 //OB.RemoveProperty(OptionName.Value); //if (SelectedDate != null) OB.AddProperty(OptionName.Value, Text); if (MaxDate != null) { OB.AddProperty("maxValue", MaxDate.Value.ToString(DateFormatString)); } if (MinDate != null) { OB.AddProperty("minValue", MinDate.Value.ToString(DateFormatString)); } if (EnableDateSelect) { OB.Listeners.AddProperty("select", JsHelper.GetFunction(GetPostBackEventReference("Select")), true); } string jsContent = String.Format("var {0}=new Ext.form.DateField({1});", XID, OB.ToString()); AddStartupScript(jsContent); }