private void radDataFilter_EditorCreated(object sender, EditorCreatedEventArgs e) { switch (e.ItemPropertyDefinition.PropertyName) { case "BrandID": RadComboBox cbxBrand = (RadComboBox)e.Editor; cbxBrand.ItemsSource = VMGlobal.PoweredBrands; break; case "Year": RadDateTimePicker dateTimePickerEditor = (RadDateTimePicker)e.Editor; dateTimePickerEditor.DateSelectionMode = DateSelectionMode.Year; dateTimePickerEditor.IsTooltipEnabled = true; dateTimePickerEditor.ErrorTooltipContent = "输入格式不正确"; dateTimePickerEditor.DateTimeWatermarkContent = "选择年份"; dateTimePickerEditor.SelectionChanged += (ss, ee) => { DateTime date = (DateTime)ee.AddedItems[0]; dateTimePickerEditor.DateTimeText = date.Year.ToString(); }; break; case "Quarter": RadComboBox cbxQuarter = (RadComboBox)e.Editor; cbxQuarter.ItemsSource = VMGlobal.Quarters; break; } }
protected void gv_sod_RowUpdating(object sender, GridViewUpdateEventArgs e) { Conexion Ocoon = new Conexion(); try { GridViewRow row = gv_SOD.Rows[gv_SOD.EditIndex]; Label lbl_id_rpsd = (Label)row.FindControl("lbl_id_rpsd"); RadNumericTextBox txt_gvsod_Exhib_Primaria = (RadNumericTextBox)row.FindControl("txt_gvsod_Exhib_Primaria"); RadNumericTextBox txt_gvsod_Exhib_Secundaria = (RadNumericTextBox)row.FindControl("txt_gvsod_Exhib_Secundaria"); RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_SOD_DETALLE_EXIBICION", lbl_id_rpsd.Text.Trim(), txt_gvsod_Exhib_Primaria.DbValue, txt_gvsod_Exhib_Secundaria.DbValue, RadDateTimePicker_fec_reg.DbSelectedDate, Session["sUser"].ToString(), DateTime.Now); gv_SOD.EditIndex = -1; cargarGrilla_SOD(); } catch (Exception ex) { ex.Message.ToString(); Response.Redirect("~/err_mensaje_seccion.aspx", true); } }
protected void gv_layout_RowEditing(object sender, GridViewEditEventArgs e) { gv_layout.EditIndex = e.NewEditIndex; cargarGrilla_Layout(); GridViewRow row = gv_layout.Rows[gv_layout.EditIndex]; Label lbl_fec_Reg = row.FindControl("lbl_fec_Reg") as Label; RadNumericTextBox txt_gvl_objetivo = (RadNumericTextBox)row.FindControl("txt_gvl_objetivo"); txt_gvl_objetivo.Enabled = true; RadNumericTextBox txt_gvl_cantidad = (RadNumericTextBox)row.FindControl("txt_gvl_cantidad"); txt_gvl_cantidad.Enabled = true; RadNumericTextBox txt_gvl_frentes = (RadNumericTextBox)row.FindControl("txt_gvl_frentes"); txt_gvl_frentes.Enabled = true; RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); RadDateTimePicker_fec_reg.Visible = true; RadDateTimePicker_fec_reg.DbSelectedDate = Convert.ToDateTime(lbl_fec_Reg.Text); lbl_fec_Reg.Visible = false; }
protected void gv_layout_RowUpdating(object sender, GridViewUpdateEventArgs e) { Conexion Ocoon = new Conexion(); try { GridViewRow row = gv_layout.Rows[e.RowIndex]; Label lbl_IdDetll_layout = (Label)row.FindControl("lbl_IdDetll_layout"); RadNumericTextBox txt_gvl_objetivo = (RadNumericTextBox)row.FindControl("txt_gvl_objetivo"); RadNumericTextBox txt_gvl_cantidad = (RadNumericTextBox)row.FindControl("txt_gvl_cantidad"); RadNumericTextBox txt_gvl_frentes = (RadNumericTextBox)row.FindControl("txt_gvl_frentes"); RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); string sUser = Session["sUser"].ToString(); Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_LAYOUT_DETALLE_CANTIDADES", lbl_IdDetll_layout.Text.Trim(), txt_gvl_objetivo.Text, txt_gvl_cantidad.Text, txt_gvl_frentes.Text, RadDateTimePicker_fec_reg.DbSelectedDate, sUser, DateTime.Now); gv_layout.EditIndex = -1; cargarGrilla_Layout(); } catch (Exception ex) { ex.Message.ToString(); Response.Redirect("~/err_mensaje_seccion.aspx", true); } }
private void cb_indicator_TextChanged(object sender, EventArgs e) { if (endTimePicker.Value < startTimePicker.Value && !string.IsNullOrEmpty(startTimePicker.Text) && !string.IsNullOrEmpty(endTimePicker.Text)) { RadDateTimePicker currentPicker = sender as RadDateTimePicker; if (currentPicker != null) { if (currentPicker.Name == "startTimePicker") { MessageBox.Show("你好,你设置的开始时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("你好。你设置的结束时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } if (bnt_print.Visible == true) { PrintOrDisplay(false);//不显示窗体 } }
/// <summary> /// Enables the disable RAD date time picker. /// </summary> /// <param name="radDateTimePicker">The RAD date time picker.</param> /// <param name="isEnabled">if set to <c>true</c> [is enabled].</param> protected void EnableDisableRadDateTimePicker(RadDateTimePicker radDateTimePicker, bool isEnabled) { radDateTimePicker.Enabled = isEnabled; radDateTimePicker.DateInput.Enabled = isEnabled; radDateTimePicker.TimePopupButton.Enabled = isEnabled; radDateTimePicker.DatePopupButton.Enabled = isEnabled; }
//按指定格式读取日期 /// <summary> /// 按指定格式读取日期 /// </summary> /// <param name="dtp">RadDateTimePicker控件名</param> /// <param name="format">格式化字符串,为空时默认为yyyy-MM-dd HH:mm:ss</param> /// <returns></returns> public static string GetValue(RadDateTimePicker dtp, string format) { if (string.IsNullOrEmpty(format)) { format = "yyyy-MM-dd HH:mm:ss"; } return(dtp.Value.ToString(format)); }
public DateTimePickerGettingStartedCSharp() { // >> datetimepicker-getting-started-csharp var dateTimePicker = new RadDateTimePicker(); // << datetimepicker-getting-started-csharp var panel = new StackLayout(); panel.Children.Add(dateTimePicker); this.Content = panel; }
public override object GetNewValueFromEditor(object editor) { RadDateTimePicker picker = editor as RadDateTimePicker; if (picker != null) { picker.DateTimeText = picker.CurrentDateTimeText; } return(base.GetNewValueFromEditor(editor)); }
public static void Reset(this RadDateTimePicker dtp1) { try { dtp1.Value = DateTime.Now; } catch (Exception ex) { _logger.LogError(ex, "An error occurred", "", ""); throw; } }
/// <summary> /// Localizes the text within the given <paramref name="dateTimePicker"/>. /// </summary> /// <param name="dateTimePicker">The <see cref="RadDateTimePicker"/> to localize the text for.</param> public static void LocalizeDateTimePicker(RadDateTimePicker dateTimePicker) { if (dateTimePicker == null) { throw new ArgumentNullException("dateTimePicker", "dateTimePicker must not be null"); } dateTimePicker.TimeView.HeaderText = Localization.GetString("Time Picker", LocalSharedResourceFile); dateTimePicker.TimePopupButton.ToolTip = Localization.GetString("Time Picker ToolTip", LocalSharedResourceFile); dateTimePicker.DatePopupButton.ToolTip = Localization.GetString("Date Picker ToolTip", LocalSharedResourceFile); LocalizeCalendar(dateTimePicker.Calendar); }
protected void RadGrid1_OnItemCreated(object sender, GridItemEventArgs e) { //var item = e.Item as GridEditableItem; //if (item != null && e.Item.IsInEditMode && e.Item.ItemIndex != -1) //{ // (item.EditManager.GetColumnEditor("NgayLap").ContainerControl.Controls[0] as RadDateTimePicker).SelectedDate = DateTime.Today; //} if (e.Item.IsInEditMode && e.Item is GridDataItem) { RadDateTimePicker rpk = (RadDateTimePicker)e.Item.FindControl("txtngaylap"); rpk.SelectedDate = DateTime.Now; } }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { this.BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDateTimePicker picker = new RadDateTimePicker(); picker.IsTooltipEnabled = false; picker.TimeInterval = this.TimeInterval; picker.SetBinding(this.BindingTarget, this.CreateValueBinding()); return picker; }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { this.BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDateTimePicker picker = new RadDateTimePicker(); picker.IsTooltipEnabled = false; picker.TimeInterval = this.TimeInterval; picker.SetBinding(this.BindingTarget, this.CreateValueBinding()); return(picker); }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDateTimePicker picker = new RadDateTimePicker(); TouchManager.SetIsTouchHitTestVisible(picker, false); picker.IsTooltipEnabled = false; picker.InputMode = InputMode.DatePicker; picker.TimeInterval = TimeInterval; picker.SetBinding(BindingTarget, CreateValueBinding()); return picker; }
/// <summary> /// Update System Theme According to Selection /// </summary> /// <param name="c"></param> /// <param name="themeName"></param> internal static void UpdateControlTheme(Control c, string themeName) { if (c is RadMaskedEditBox) { RadMaskedEditBox rm = (RadMaskedEditBox)c; rm.ThemeName = themeName; } if (c is RadTextBox) { RadTextBox txt = (RadTextBox)c; txt.ThemeName = themeName; } if (c is RadDropDownList) { RadDropDownList ddl = (RadDropDownList)c; ddl.ThemeName = themeName; } if (c is RadGridView) { RadGridView ddl = (RadGridView)c; ddl.ThemeName = themeName; } if (c is RadGroupBox) { RadGroupBox rg = (RadGroupBox)c; rg.ThemeName = themeName; } if (c is RadButton) { RadButton btn = (RadButton)c; btn.ThemeName = themeName; } if (c is RadDateTimePicker) { RadDateTimePicker dtp = (RadDateTimePicker)c; dtp.ThemeName = themeName; } if (c is RadPageView) { RadPageView pv = new RadPageView(); pv.ThemeName = themeName; } //Also update theme for children foreach (Control ch in c.Controls) { UpdateControlTheme(ch, themeName); } }
/// <summary> /// 选择时间事件 /// </summary> private void OnSelectedValueChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(dt_start.Text) && !string.IsNullOrEmpty(dt_end.Text)) { MessageBox.Show("请先选择开始时间。"); return; } if (!string.IsNullOrEmpty(dt_end.Text) && !string.IsNullOrEmpty(dt_start.Text) && dt_end.Value < dt_start.Value) { RadDateTimePicker currentPicker = sender as RadDateTimePicker; if (currentPicker != null) { if (currentPicker.Name == "dt_start") { MessageBox.Show("你好,你设置的开始时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("你好。你设置的结束时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } else { DateTime d = dt_start.Value; string starttime = d.ToString("yyyy/MM/dd hh:mm:ss"); DateTime p = !string.IsNullOrEmpty(dt_end.Text) ? dt_end.Value.AddDays(1) : DateTime.Now; DateTime endDate = new DateTime(p.Year, p.Month, p.Day).AddDays(1).AddMilliseconds(-1); string endtime = endDate.ToString("yyyy/MM/dd hh:mm:ss"); dgv_01.Rows.Clear(); foreach (GridViewRowInfo item in _dataGridAllRows) { DateTime cellValue = DateTime.Parse(item.Cells["s_time"].Value.ToString()); if (DateTime.Compare(dt_start.Value, cellValue) < 0 && DateTime.Compare(endDate, cellValue) > 0) { dgv_01.Rows.Add(item); } } } if (dgv_01.RowCount > 0) { dgv_01.CurrentRow = dgv_01.Rows[0]; } }
/// <summary> /// Creates child controls. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); m_RadDateTimePicker = new RadDateTimePicker(); m_RadDateTimePicker.Skin = m_RadDateTimePicker.Calendar.Skin = "Default"; base.RequiredFieldValidator.ControlToValidate = m_RadDateTimePicker.ID = "rdp"; m_RadDateTimePicker.DateInput.EnableEmbeddedBaseStylesheet = false; m_RadDateTimePicker.DateInput.EnableEmbeddedSkins = false; m_RadDateTimePicker.DatePopupButton.ToolTip = string.Empty; m_RadDateTimePicker.TimePopupButton.ToolTip = string.Empty; m_RadDateTimePicker.SelectedDateChanged += new SelectedDateChangedEventHandler(OnSelectedDateChanged); ResetToDatePickerType(); Controls.Add(m_RadDateTimePicker); }
protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e) { string UserID = (string)Session["UserID"].ToString(); //string UserID = "27276"; if (UserID == null) { Response.Redirect("http://portal.footgear.com.vn/"); } else { if (e.Container.Mode == SchedulerFormMode.Insert) { Status = "Insert"; } if (e.Container.Mode == SchedulerFormMode.AdvancedInsert) { Status = "AdvancedInsert"; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); startInput.SelectedDate = e.Appointment.Start; endInput.SelectedDate = e.Appointment.End; } if (e.Container.Mode == SchedulerFormMode.AdvancedEdit) { HiddenField hdffID = ((HiddenField)e.Container.FindControl("hdfID")); hdffID.Value = e.Appointment.ID.ToString(); DataTable dt = dal.QryTheoTheoID(int.Parse(hdffID.Value)); TextBox subjectBox = (TextBox)e.Container.FindControl("SubjectTextBox"); subjectBox.Text = e.Appointment.Subject; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); startInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.Start); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); endInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.End); RadTextBox txtDescription = (RadTextBox)e.Container.FindControl("txtDescription"); txtDescription.Text = e.Appointment.Description; RadTextBox txtLink = (RadTextBox)e.Container.FindControl("txtLink"); RadNumericTextBox txtPhanTram = (RadNumericTextBox)e.Container.FindControl("txtPhanTram"); OCanlendar objec = new OCanlendar(); txtLink.Text = dt.Rows[0]["wklink"].ToString(); txtPhanTram.Text = dt.Rows[0]["jobpercent"].ToString(); } } }
protected void gv_quiebre_RowEditing(object sender, GridViewEditEventArgs e) { gv_quibre.EditIndex = e.NewEditIndex; cargarGrilla_Quiebre(); GridViewRow row = gv_quibre.Rows[gv_quibre.EditIndex]; Label lbl_fec_Reg = row.FindControl("lbl_fec_Reg") as Label; RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); RadDateTimePicker_fec_reg.Visible = true; RadDateTimePicker_fec_reg.DbSelectedDate = Convert.ToDateTime(lbl_fec_Reg.Text); lbl_fec_Reg.Visible = false; }
public static string GetValue(this RadDateTimePicker dtp, bool check) { try { if (check) { return(dtp.Checked ? dtp.Value.ToShortDateString() : ""); } return(dtp.Value.ToShortDateString()); } catch (Exception ex) { _logger.LogError(ex, "An error occurred", "", ""); throw; } }
public static bool CompareTo(this RadDateTimePicker dtp1, RadDateTimePicker dtp2) { try { if (!dtp1.Checked) { return(true); } return(dtp1.Value <= dtp2.Value); } catch (Exception ex) { _logger.LogError(ex, "An error occurred", "", ""); throw; } }
public override FrameworkElement CreateFieldFilterEditor() { var dateTimePicker = new RadDateTimePicker(); dateTimePicker.InputMode = InputMode.DatePicker; dateTimePicker.IsTooltipEnabled = false; var selectedValueBinding = new Binding("Value") { Mode = BindingMode.TwoWay, FallbackValue = null, Converter = new DateTimeFilterEditorConverter() }; dateTimePicker.SetBinding(RadDateTimePicker.SelectedValueProperty, selectedValueBinding); return(dateTimePicker); }
protected override void OnEditorNeeded(EditorNeededEventArgs args) { int propertyIndex = this.GetPropertyIndex("Established"); if (args.ColumnIndex == propertyIndex) { var editor = new RadDateTimePicker(); var item = (this.Source.GetItemAt(args.RowIndex) as Club); args.Editor = editor; editor.SelectedValue = item.Established; args.EditorProperty = RadDateTimePicker.SelectedValueProperty; } else { base.OnEditorNeeded(args); } }
protected void gridMain_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridFilteringItem) { GridFilteringItem filterItem = (GridFilteringItem)e.Item; (filterItem["DateStamp"].Controls[0] as LiteralControl).Text = "Από: "; (filterItem["DateStamp"].Controls[3] as LiteralControl).Text = "<br />Έως: "; RadDateTimePicker OrderDateFrom = filterItem["DateStamp"].Controls[1] as RadDateTimePicker; OrderDateFrom.TimePopupButton.Visible = false; OrderDateFrom.DateInput.DisplayDateFormat = "d/M/yyyy"; OrderDateFrom.DateInput.DateFormat = "d/M/yyyy"; RadDateTimePicker OrderDateTo = filterItem["DateStamp"].Controls[4] as RadDateTimePicker; OrderDateTo.TimePopupButton.Visible = false; OrderDateTo.DateInput.DisplayDateFormat = "d/M/yyyy"; OrderDateTo.DateInput.DateFormat = "d/M/yyyy"; OrderDateFrom.DateInput.Attributes.Add("onchange", "javascript:UpdateTo('" + OrderDateFrom.ClientID + "', '" + OrderDateTo.ClientID + "');"); } }
protected void gv_exhibicion_RowEditing(object sender, GridViewEditEventArgs e) { gvExhib.EditIndex = e.NewEditIndex; cargarGrilla_Exibicion(); GridViewRow row = gvExhib.Rows[gvExhib.EditIndex]; Label lbl_fec_Reg = row.FindControl("lbl_fec_Reg") as Label; RadNumericTextBox txt_gve_cantidad = (RadNumericTextBox)row.FindControl("txt_gve_cantidad"); txt_gve_cantidad.Enabled = true; RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); RadDateTimePicker_fec_reg.Visible = true; RadDateTimePicker_fec_reg.DbSelectedDate = Convert.ToDateTime(lbl_fec_Reg.Text); lbl_fec_Reg.Visible = false; }
protected void gv_quiebre_RowUpdating(object sender, GridViewUpdateEventArgs e) { Conexion Ocoon = new Conexion(); try { GridViewRow row = gv_quibre.Rows[gv_quibre.EditIndex]; Label lbl_Id_Quiebre_Detall = (Label)row.FindControl("lbl_Id_Quiebre_Detall"); RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_QUIEBRE_DETALLE", lbl_Id_Quiebre_Detall.Text.Trim(), RadDateTimePicker_fec_reg.DbSelectedDate, Session["sUser"].ToString(), DateTime.Now); gv_quibre.EditIndex = -1; cargarGrilla_Quiebre(); } catch (Exception ex) { ex.Message.ToString(); } }
private void OnSelectedValueChanged(object sender, EventArgs e) { if (dt_end.Value < dt_start.Value && !string.IsNullOrEmpty(dt_start.Text) && !string.IsNullOrEmpty(dt_end.Text)) { RadDateTimePicker currentPicker = sender as RadDateTimePicker; if (currentPicker != null) { if (currentPicker.Name == "dt_start") { MessageBox.Show("你好,你设置的开始时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("你好。你设置的结束时间有误。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } else { DateTime d = dt_start.Value; string starttime = d.ToString("yyyy/MM/dd hh:mm:ss"); DateTime p = dt_end.Value; string endtime = d.ToString("yyyy/MM/dd hh:mm:ss"); dgv_01.Rows.Clear(); foreach (GridViewRowInfo item in _dataGridAllRows) { DateTime cellValue = DateTime.Parse(item.Cells["s_time"].Value.ToString()); if (DateTime.Compare(dt_start.Value, cellValue) < 0 && DateTime.Compare(dt_end.Value, cellValue) > 0) { dgv_01.Rows.Add(item); } } } }
protected void RadGrid1_OnItemDataBound(object sender, GridItemEventArgs e) { var txttongtien = e.Item.FindControl("txttongtien") as RadNumericTextBox; var txtidphieuchi = e.Item.FindControl("txtidphieuchi") as RadTextBox; if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { var item = (GridEditFormItem)e.Item; if (!(e.Item is IGridInsertItem)) { txttongtien.Text = DataBinder.Eval(e.Item.DataItem, "TongTien").ToString(); } txtidphieuchi.Text = DataBinder.Eval(e.Item.DataItem, "ID").ToString(); } //var item = e.Item as GridEditableItem; //if (item != null && e.Item.IsInEditMode && e.Item.ItemIndex != -1) //{ // (item.EditManager.GetColumnEditor("NgayLap").ContainerControl.Controls[0] as RadDateTimePicker).SelectedDate = DateTime.Now.Date; //} if (e.Item.IsInEditMode && e.Item is GridDataItem) { RadDateTimePicker rpk = (RadDateTimePicker)e.Item.FindControl("txtngaylap"); rpk.SelectedDate = DateTime.Now; } if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditFormItem dataItem = e.Item as GridEditFormItem; TableCell cell = dataItem["ShippedDate"]; RadDatePicker rdp = cell.Controls[0] as RadDatePicker; rdp.SharedCalendar.UseColumnHeadersAsSelectors = false; rdp.SharedCalendar.UseRowHeadersAsSelectors = false; rdp.SharedCalendar.RangeMaxDate = DateTime.Now; //rdp.SharedCalendar.RangeMinDate = System.DateTime.Now.AddDays(-30); } }
void saveButton_Click(object sender, EventArgs e) { RadTextBox textBox = (RadTextBox)this.userControl.Controls["textBox"]; this.RowInfo.Cells["TextBoxColumn"].Value = textBox.Text; RadDateTimePicker dateTimePicker = (RadDateTimePicker)this.userControl.Controls["dateTimePicker"]; if (dateTimePicker.Value != dateTimePicker.NullDate) { this.RowInfo.Cells["DateTimeColumn"].Value = dateTimePicker.Value; } //add new row GridViewNewRowInfo newRow = this.RowInfo as GridViewNewRowInfo; if (newRow != null) { newRow.EndAddNewRow(); } this.button.DropDownMenu.ClosePopup(RadPopupCloseReason.AppFocusChange); }
protected void gv_sod_RowEditing(object sender, GridViewEditEventArgs e) { gv_SOD.EditIndex = e.NewEditIndex; cargarGrilla_SOD(); GridViewRow row = gv_SOD.Rows[gv_SOD.EditIndex]; Label lbl_fec_Reg = row.FindControl("lbl_fec_Reg") as Label; RadNumericTextBox txt_gvsod_Exhib_Primaria = (RadNumericTextBox)row.FindControl("txt_gvsod_Exhib_Primaria"); RadNumericTextBox txt_gvsod_Exhib_Secundaria = (RadNumericTextBox)row.FindControl("txt_gvsod_Exhib_Secundaria"); txt_gvsod_Exhib_Primaria.Enabled = true; txt_gvsod_Exhib_Secundaria.Enabled = true; RadDateTimePicker RadDateTimePicker_fec_reg = (RadDateTimePicker)row.FindControl("RadDateTimePicker_fec_reg"); RadDateTimePicker_fec_reg.Visible = true; RadDateTimePicker_fec_reg.DbSelectedDate = Convert.ToDateTime(lbl_fec_Reg.Text); lbl_fec_Reg.Visible = false; }
private WebControl CreateDateTimeControl(CustomField field, int width) { RadDateTimePicker result = new RadDateTimePicker(); result.Width = Unit.Pixel(width); if (_autoSave) { result.ClientEvents.OnDateSelected = "function(sender, args) { top.privateServices.SaveCustomFieldDate(" + _refID.ToString() + "," + field.CustomFieldID.ToString() + ", args.get_newValue()); }"; } if (_clientSaveEvent != "") { result.ClientEvents.OnDateSelected = _clientSaveEvent; } result.MinDate = new DateTime(1900, 1, 1); result.ID = FieldIDToControlID(field.CustomFieldID); result.Culture = UserSession.LoginUser.CultureInfo; if (field.IsRequired) { result.CssClass = "validateDateTime"; } //_customControls.Add(new CustomControl(result, "/*$find('{0}').get_selectedDate()*/ new Date()", "SaveCustomFieldDate", _refID, field.CustomFieldID)); _customControls.Add(new CustomControl(result, "ConvertDate($find('{0}').get_selectedDate())", "SaveCustomFieldDate", _refID, field.CustomFieldID)); return(result); }
/// <summary> /// 以View的实例初始化ViewModel相关字段、属性 /// </summary> private void ViewModelInitializer() { this.LineGrid = this._view.LineGrid; this.BarGrid = this._view.BarGrid; this.AircraftPieGrid = this._view.AircraftPieGrid; this.SeatPieGrid = this._view.SeatPieGrid; this.LoadPieGrid = this._view.LoadPieGrid; //控制界面起止时间控件的字符串格式化 this.StartDateTimePicker = _view.StartDateTimePicker as RadDateTimePicker; this.EndDateTimePicker = _view.EndDateTimePicker as RadDateTimePicker; StartDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; EndDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; }
/// <summary> /// 以View的实例初始化ViewModel相关字段、属性 /// </summary> private void ViewModelInitializer() { this.LineGrid = _view.LineGrid as Grid; this.AgePieGrid = _view.AgePieGrid as Grid; this.aircraftDetail = _view.aircraftDetail as RadGridView; //控制界面起止时间控件的字符串格式化 this.StartDateTimePicker = _view.StartDateTimePicker as RadDateTimePicker; this.EndDateTimePicker = _view.EndDateTimePicker as RadDateTimePicker; StartDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; EndDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; }
private void LoadControlToPage(int ReportId) { try { Panel.Controls.Clear(); cls_Report_User objUser = new cls_Report_User(); DataSet _ds = objUser.GetConfigReport(ReportId); DataTable _dtConfig = _ds.Tables[0]; if (_dtConfig.Rows.Count == 0) return; ViewState["Config"] = _dtConfig; short TabIndex = 1; Label LB; string[] ArrRow =null; int t = 0; int k = 0; while (k < _dtConfig.Rows.Count) { if (ArrRow == null) Array.Resize(ref ArrRow, 1); else Array.Resize(ref ArrRow, ArrRow.Length + 1); if (k < _dtConfig.Rows.Count - 1 && (Convert.ToInt32(_dtConfig.Rows[k]["Width"]) + Convert.ToInt32(_dtConfig.Rows[k + 1]["Width"]) <= (848 - 848 / 3))) { ArrRow[t] = k.ToString() + ":" + (k + 1).ToString(); k++; } else { ArrRow[t] = k.ToString(); } t++; k++; } //Lay max text string strMax = ""; for (k = 0; k < ArrRow.Length; k++) { if (ArrRow[k] != null && ArrRow[k].Length > 0) { if (ArrRow[k].IndexOf(":") >= 0) { string[] ArStr = ArrRow[k].Split(':'); if (_dtConfig.Rows[Convert.ToInt32(ArStr[0])]["Parameter_Name"].ToString().Length > strMax.Length) strMax = _dtConfig.Rows[Convert.ToInt32(ArStr[0])]["Parameter_Name"].ToString(); } else { if (_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString().Length > strMax.Length) strMax = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString(); } } } strMax += ": "; // for (k = 0; k < ArrRow.Length; k++) { if (k > 0) { HtmlAnchor te = new HtmlAnchor(); te.InnerHtml = "<br />"; Panel.Controls.Add(te); HtmlAnchor te1 = new HtmlAnchor(); te1.InnerHtml = "<br />"; Panel.Controls.Add(te1); } if (ArrRow[k].Length > 0) { if (ArrRow[k].IndexOf(":") >= 0) { string[] ArStr = ArrRow[k].Split(':'); for (int j = 0; j < ArStr.Length; j++) { LB = new Label(); if (j > 0) { HtmlAnchor tex = new HtmlAnchor(); //tex.InnerText = tex.InnerHtml = " "; Panel.Controls.Add(tex); } string str = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Name"].ToString() + ": "; LB.Text = str; Panel.Controls.Add(LB); if(j==0) if (str.Length < strMax.Length) { string sadd =""; for (int y = 0; y <= strMax.Length - str.Length;y++ ) sadd += " "; HtmlAnchor add = new HtmlAnchor(); add.InnerHtml = sadd; Panel.Controls.Add(add); } string sCate = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Control_Type"].ToString(); if (sCate == "TextBox") { TextBox TB = new TextBox(); TB.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); TB.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); TB.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); TB.TabIndex = TabIndex; Panel.Controls.Add(TB); } if (sCate == "DatePicker") { RadDatePicker date = new RadDatePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "DateTimePicker") { RadDateTimePicker date = new RadDateTimePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "ComboBox") { RadComboBox com = new RadComboBox(); com.Skin = "Vista"; com.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"])*5; com.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); com.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); com.EnableVirtualScrolling = true; string SQL = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Data_SQL"].ToString(); if (SQL.Length > 0) { DataTable _dt; if (_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"] != null && Convert.ToBoolean(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"]) == true) { int Index = SQL.IndexOf('@'); if (Index >= 0) _dt = objUser.GetSP(SQL.Substring(0, Index), SQL.Substring(Index, SQL.Length - Index), Session["UserId"] == null ? "0" : Session["UserId"].ToString()); else _dt = objUser.GetSP(SQL); } else _dt = objUser.GetSQL(SQL); com.DataValueField = "ID"; com.DataTextField = "Name"; com.DataSource = _dt; com.DataBind(); } com.TabIndex = TabIndex; Panel.Controls.Add(com); } TabIndex++; } } else { LB = new Label(); string str = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString() + ": "; LB.Text = str; Panel.Controls.Add(LB); if (str.Length < strMax.Length) { string sadd = ""; for (int y = 0; y <= strMax.Length - str.Length; y++) sadd += " "; HtmlAnchor add = new HtmlAnchor(); add.InnerHtml = sadd; Panel.Controls.Add(add); } string sCate = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Control_Type"].ToString(); if (sCate == "TextBox") { TextBox TB = new TextBox(); TB.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); TB.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); TB.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); TB.TabIndex = TabIndex; Panel.Controls.Add(TB); } if (sCate == "DatePicker") { RadDatePicker date = new RadDatePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "DateTimePicker") { RadDateTimePicker date = new RadDateTimePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "ComboBox") { RadComboBox com = new RadComboBox(); com.Skin = "Vista"; com.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]) * 5; com.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); com.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); com.EnableVirtualScrolling = true; string SQL = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Data_SQL"].ToString(); if (SQL.Length > 0) { DataTable _dt; if (_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["IsSP"] != null && Convert.ToBoolean(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["IsSP"]) == true) { int Index = SQL.IndexOf('@'); if (Index >= 0) _dt = objUser.GetSP(SQL.Substring(0, Index), SQL.Substring(Index, SQL.Length - Index), Session["UserId"] == null ? "0" : Session["UserId"].ToString()); else _dt = objUser.GetSP(SQL); } else _dt = objUser.GetSQL(SQL); com.DataValueField = "ID"; com.DataTextField = "Name"; com.DataSource = _dt; com.DataBind(); } com.TabIndex = TabIndex; Panel.Controls.Add(com); } TabIndex++; } } } // } catch (Exception ex) { } }
/// <summary> /// 以View的实例初始化ViewModel相关字段、属性 /// </summary> private void ViewModelInitializer() { this.LineGrid = _view.LineGrid as Grid; this.BarGrid = _view.BarGrid as Grid; this.SupplierPieGrid = _view.SupplierPieGrid as Grid; this.aircraftDetail = _view.aircraftDetail as RadGridView; this.StartDateTimePicker = _view.StartDateTimePicker as RadDateTimePicker; this.EndDateTimePicker = _view.EndDateTimePicker as RadDateTimePicker; StartDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; EndDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; }
/// <summary> /// 以View的实例初始化ViewModel相关字段、属性 /// </summary> private void ViewModelInitializer() { this.MonthGrid = _view.MonthGrid as Grid; this.YearGrid = _view.YearGrid as Grid; //控制界面起止时间控件的字符串格式化 this.StartDateTimePicker = _view.StartDateTimePicker as RadDateTimePicker; this.EndDateTimePicker = _view.EndDateTimePicker as RadDateTimePicker; StartDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; EndDateTimePicker.Culture.DateTimeFormat.ShortDatePattern = "yyyy/M"; }