Hi guys,
I need to create a control dynamically and used with this features
- Shows date and time like "dd-mm-yyyy hh:mm" [ DONE: using base.DateInput.DateFormat = "dd-MM-yyyy HH:mm"; ]
- Shows date and time like "dd-mm-yyyy hh:mm" [ DONE: using base.DateInput.DateFormat = "dd-MM-yyyy HH:mm"; ]
- Only shows one button icon (not the 2 buttons like RadDateTime) [ DONE: using RadDatePicker ]
- Shows the text as a label if the page (if the control is in a page) / row (if the control in in a Grid) is not in Edit mode [ Need help! ]
How can I do this?
Right now I'm doing:
| [DefaultProperty("Value")] |
| [ToolboxData("<{0}:MyOwnDateTimePicker runat=server></{0}:MyOwnDateTimePicker>")] |
| public class MyOwnDateTimePicker : Telerik.Web.UI.RadDatePicker |
| { |
| System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler; |
| protected override void Render(HtmlTextWriter writer) |
| { |
| /* |
| <telerik:RadDatePicker ID="Raddatepicker2" Style="vertical-align: middle;" Width="200px" |
| MinDate="2006-02-01" runat="server" SelectedDate="2006-04-01" MaxDate="2099-12-16" Skin="Hay"> |
| <DateInput onclick="ToggleSecondPopup()" DateFormat="D"> |
| </DateInput> |
| </telerik:RadDatePicker> |
| */ |
| base.Skin = "Outlook"; |
| base.DateInput.DateFormat = "dd-MM-yyyy HH:mm"; |
| base.Render(writer); |
| } |
| public override void RenderControl(HtmlTextWriter writer) |
| { |
| // Bruno: Test |
| if (this.readOnly) |
| { |
| // Read-Only Calendar |
| // http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/readonlycalendar/defaultcs.aspx |
| // PresentationType="Preview", EnableNavigation="False" and EnableMonthYearFastNavigation="false" |
| base.Calendar.PresentationType = Telerik.Web.UI.Calendar.PresentationType.Preview; |
| base.Calendar.EnableNavigation = false; |
| base.Calendar.EnableMonthYearFastNavigation = false; |
| //Label lbl = new Label(); |
| //lbl.RenderControl(writer); |
| } |
| else |
| { |
| //Do nothing |
| } |
| base.RenderControl(writer); |
| } |
How can I make the control to be ReadOnly? Showing only a "Label" like control?