/// <summary> /// As there are so many overrides for the In-Dialog option, the building of the option is /// abstracted out /// </summary> /// <param name="date">Initial date for the date picker as Date (if it's a string it should already have quotes in place).</param> /// <param name="onSelect"> /// A callback function when a date is selected. The function receives the date text /// and date picker instance as parameters. /// </param> /// <param name="leftPosition">The position of the left of the dialog</param> /// <param name="topPosition">The position of the top/left of the dialog</param> /// <param name="settings">The new settings for the date picker.</param> private void DialogBuilder(string date, string onSelect, int? leftPosition, int? topPosition, Options settings) { string position = null; if (leftPosition.HasValue && topPosition.HasValue) { List<int> posList = new List<int>() { leftPosition.Value, topPosition.Value }; position = posList.JsArray(); } if (!string.IsNullOrEmpty(onSelect)) { onSelect = "function(dateStr, dateInst) { " + onSelect + " }"; } else { onSelect = null; } this.RenderMethodCall("dialog", date, onSelect, settings, position); }
/// <summary> /// Open a datepicker in a "dialog" box. /// </summary> /// <param name="date">Initial date for the date picker as a string in the current date format.</param> /// <param name="onSelect"> /// A callback function when a date is selected. /// The function receives the date text and date picker instance as parameters. /// </param> /// <param name="leftPosition">The position of the left of the dialog</param> /// <param name="topPosition">The position of the top/left of the dialog</param> /// <param name="settings">The new settings for the date picker.</param> public void Dialog(string date, string onSelect, int? leftPosition, int? topPosition, Options settings) { this.DialogBuilder(date.InSingleQuotes(), onSelect, leftPosition, topPosition, settings); }
/// <summary> /// Open a datepicker in a "dialog" box. /// </summary> /// <param name="date">Initial date for the date picker as a string in the current date format.</param> /// <param name="onSelect"> /// A callback function when a date is selected. /// The function receives the date text and date picker instance as parameters. /// </param> /// <param name="settings">The new settings for the date picker.</param> public void Dialog(string date, string onSelect, Options settings) { this.Dialog(date.InSingleQuotes(), onSelect, null, null, settings); }
/// <summary> /// Open a datepicker in a "dialog" box. /// </summary> /// <param name="date">Initial date for the date picker as Date.</param> /// <param name="onSelect">A callback function when a date is selected. The function receives the date text and date picker instance as parameters.</param> /// <param name="leftPosition">The position of the left of the dialog</param> /// <param name="topPosition">The position of the top/left of the dialog</param> /// <param name="settings">The new settings for the date picker.</param> public void Dialog(DateTime date, string onSelect, int? leftPosition, int? topPosition, Options settings) { this.DialogBuilder(date.JsDate(), onSelect, leftPosition, topPosition, settings); }
/// <summary> /// Open a datepicker in a "dialog" box. /// </summary> /// <param name="date">Initial date for the date picker as Date.</param> /// <param name="onSelect"> /// A callback function when a date is selected. /// The function receives the date text and date picker instance as parameters. /// </param> /// <param name="settings">The new settings for the date picker.</param> public void Dialog(DateTime date, string onSelect, Options settings) { this.Dialog(date, onSelect, null, null, settings); }