I want to validate the RadDatePicker when a date is selected. User should not select greater than a particular date ? How can I restrict user from selecting a date which is not greater than a particular date.
Particular date populated from the database.
You can use CompareValidator Control.Just note to compare to your date (ValueToCompare) instead of (ControlToCompare) and set the type. By default it's string as i remember.so you need to set it to Date.Also look to this page.
On your other question:
How can I restrict user from selecting a date which is not greater than a particular date.
In C#:
RadDatePicker1.MaxDate = myMaxDateTimeVariable;
or client-side:
var radDatePicker1 = $find("<%= RadDatePicker1.ClientID %>");
radDatePicker1.set_maxDate(myMaxDate);
Related
I am trying to filter a table using a DateBox. The problem I have is that it doesn't display the records of that day when binding value is set to #datasource.query.filters.date._equals. However, it does work when the filter is _greaterThanOrEquals, but it also includes later records.
I am using SQL tables with date field type is DATE.
It's a bug. We're looking into it.
For now please use workaround:
Remove the binding and set 2 filters in onValueEdit event with code like:
widget.datasource.query.filters.FIELD_NAME._greaterThanOrEquals = newValue;
widget.datasource.query.filters.FIELD_NAME._lessThanOrEquals = newValue ? new Date(newValue.getTime() + 24*60*60*1000) : null;
widget.datasource.load();
bind DateBox value to
#datasource.query.filters.NameOfDateFiled._equals
and don't forget reload datasource in "onValueChange" event.
How can i select Datakey value of a grid .? I tried but only getting inside selected index changed event.
[In my application there is a grid.In that grid there link buttons.My issue is when i am clicking on link button i want to acceess value in Datakeynames. is there any method to access value in Datakeynames. or is there any other property for grid to keep key values ].Please help
You have your answer at below link
How to get the Command Argument on Row Data bound Event of gridview
Happy coding!!!
Try like this,
Assign your Value in the Command Argument.
In RowCommand Event,
if (e.CommandName == "Link")
{
string Value = e.CommandArgument.ToString();
}
By default asp.net calendar control shows dates of current month. How is it possible to change programatically default month view?
Thanks!
You can use VisibleDate Property like:
int yourdesiredmonth = 5;
Calendar1.VisibleDate = new DateTime(Calendar1.TodaysDate.Year,yourdesiredmonth,1);
I have the need to display a date in this format: dd/mm/yyyy. This is actually being stored in an ASP.NET textbox and being used as a control parameter for a select on the GridView. When the query is run, though, the date format should change to 'd M y' (for Oracle). It is not working. Can someone tell me what I'm doing wrong? Right now I am pushing the "new" format to a invisible label and using the label as my control param:
$(document).ready(function() {
//datepicker for query, shown traditionally but holding an Oracle-needed format
$('[id$=txtBeginDate]').datepicker({ minDate: -7 , altFormat: 'd M y' });
//get alt format
var altFormat = $('[id$=txtBeginDate]').datepicker("option", "altFormat");
//set date to be altformat
$('[id$=lblActualDate]').datepicker("option", "altFormat", 'd M y');
});
why not do the formatting on the server-side when building your Oracle query?
System.DateTime dt = DateTime.Parse(txtBeginDate.Text);
dt.ToString("dd MM yyyy")
SqlDataSource can only use server-side asp.net controls for ControlParameters. To use your jQuery datepicker, you'll have to get a little fancy.
Put a plain Parameter and then handle the SqlDataSource's Selecting event to set the value for the parameter from the Request object (with suitable validation and formatting) by hand.
I am using the Ajax Control Toolkit Calendar Extender control. In some fields though I want to display the time along with the date. I have tried just setting the Format to "dd/MM/yyyy hh:mm:ss" but the time section gets wiped off. If the user wants to change the time section they can do it manually, the calendar drop down is only used for changing the date part.
Are there any workarounds or alternatives to get this working?
I have a similar issue and I'm planning to use a Date field and an associated time dropdown (in 1/2 hour increments). User sets the date in the date field, optionally using the calendar control, and pulls down to a valid time. I plan to have one selection in the time drop down be a "don't care" in case it an "all day" event.
[EDIT] I found this jquery plugin that I may end up using. I also found a link to Gaia DateTimePicker in the answers to this post (which now looks to be deleted, probably because the OP was asking for WPF controls, not web controls).
The Ra-Ajax Calendar is coming out with TIME support this upcoming Friday (28th of Nov. 2008) and it's LGPL licensed...
Based on CalendarExtender, you can set the format as "MM/dd/yyyy". After the user select the date in calendar, it will return 04/28/2009 for example. In the date selected event, you can append the current time after the date returned.
OnClientDateSelectionChanged="dateselect"
function dateselect(ev)
{
var calendarBehavior1 = $find("Calendar1");
var d = calendarBehavior1._selectedDate;
var now = new Date();
calendarBehavior1.get_element().value = d.format("MM/dd/yyyy") + " "+now.format("HH:mm:ss")
}
The only way to add time component to the AjaxControlToolKit CalendarExtender, is to append it using OnClientDateSelectionChanged and JavaScript.
<ajaxToolkit:CalendarExtender ID="ce1" runat="server" PopupButtonID="calImg" Enabled="true" Format="dd/MM/yyyy" TargetControlID="txtLeft" PopupPosition="TopRight" OnClientDateSelectionChanged="AppendTime"></ajaxToolkit:CalendarExtender>
and
<script language="javascript" type="text/javascript">
//this script will get the date selected from the given calendarextender (ie: "sender") and append the
//current time to it.
function AppendTime(sender, args) {
var selectedDate = new Date();
selectedDate = sender.get_selectedDate();
var now = new Date();
sender.get_element().value = selectedDate.format("dd/MM/yyyy") + " " + now.format("hh:mm tt");
}
</script>