SolutionStream
Top achievements
Rank 1
SolutionStream
asked on 13 May 2009, 05:31 PM
Is it possible to set the scheduler's SelectedDate with a client side javascript call?
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 14 May 2009, 09:59 AM
Hello Keir,
One suggestion would be to using RadAjaxManager and updating the RadScheduler from code behind. Here is the code which I tried.
ASPX:
JavaScript:
CS:
You can also refer the following forum link:
Client side selected date modification
Thanks,
Shinu.
One suggestion would be to using RadAjaxManager and updating the RadScheduler from code behind. Here is the code which I tried.
ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:radscheduler id="RadScheduler1" runat="server" Skin="Vista"> |
</telerik:radscheduler> |
<asp:Button ID="Button1" runat="server" Text="Select Date from client" OnClientClick="SelectDate(); return false;"/> |
JavaScript:
<script type="text/javascript"> |
function SelectDate() |
{ |
$find("<%=RadAjaxManager1.ClientID %>").ajaxRequest('Button1'); |
} |
</script> |
CS:
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
if (e.Argument == Button1.ClientID) |
{ |
RadScheduler1.SelectedDate = DateTime.Today.AddDays(1); // Add one day and set as selected date |
} |
} |
You can also refer the following forum link:
Client side selected date modification
Thanks,
Shinu.
0
SolutionStream
Top achievements
Rank 1
answered on 14 May 2009, 03:30 PM
Shinu;
Thanks for your response, unfortunately i'm not sure how or even if I can add a code behind file to our MVC.net project. Is there no other way?
0
SolutionStream
Top achievements
Rank 1
answered on 14 May 2009, 10:54 PM
Ok, so i have figured out how to set the initial time display using Jquery, but am concerned that i'm not really putting my value into the correct input.
$(function() { |
$("#ctl00_MainContent_RadTimePicker_StartTime_dateInput_text").val('<%= Model.StartTime.ToShortTimeString() %>'); |
$("#ctl00_MainContent_RadTimePicker_EndTime_dateInput_text").val('<%= Model.EndTime.ToShortTimeString() %>'); |
}) |
Is there a more appropriate input field?
0
Hello Kier,
Please, be advised that RadScheduler does not support ASP.NET MVC at the time being. For more information, review this help topic:
http://www.telerik.com/help/aspnet-ajax/mvc-limitations.html
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Please, be advised that RadScheduler does not support ASP.NET MVC at the time being. For more information, review this help topic:
http://www.telerik.com/help/aspnet-ajax/mvc-limitations.html
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 28 Oct 2010, 11:33 AM
How can ^this exact functionality be achieved when working in a content page and with a RadAjaxManagerProxy?
I have these two script functions in my markup file:
And
And the grid's related markup:
The code-Behind:
Result is, I get a console error I get through Firebug:
Anybody with clues, any pointers will be highly regarded.
I have these two script functions in my markup file:
function
RowClick(sender, eventArgs) {
var
grid = sender;
var
MasterTable = grid.get_masterTableView();
var
row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
var
cell = MasterTable.getCellByColumnUniqueName(row,
"ColumnJobDate"
);
//here cell.innerHTML holds the value of the cell
//alert(cell.innerHTML);
SelectDate(cell.innerHTML);
}
And
function
SelectDate(_DateValue) {
$find(
"<%= RadAjaxManager.GetCurrent(Page).ClientID %>"
).ajaxRequest(
"-||DATE||-"
+ _DateValue);
}
And the grid's related markup:
<
ClientSettings
AllowRowsDragDrop
=
"True"
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"false"
/>
<
ClientEvents
OnRowDropping
=
"rowDropping"
OnRowClick
=
"RowClick"
/>
</
ClientSettings
>
The code-Behind:
protected
void
manager_AjaxRequest(
object
sender, AjaxRequestEventArgs e) {
//handle the manager AjaxRequest event here
if
(e.Argument.Contains(
"-||DATE||-"
)) {
string
extractedDate = e.Argument.Remove(0, 10);
DateTime realDate = DateTime.Parse(extractedDate);
RadSchedulerArmy.SelectedDate =
new
DateTime(realDate.Year, realDate.Month, realDate.Day);
}
}
protected
void
Page_Load(
object
sender, EventArgs e) {
RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
manager.ClientEvents.OnRequestStart =
"onRequestStart"
;
manager.ClientEvents.OnResponseEnd =
"onResponseEnd"
;
manager.AjaxRequest +=
new
RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
if
(Page.IsPostBack ==
false
) {
//TODO Implement a better user login...
//code code code
}
}
Result is, I get a console error I get through Firebug:
onRequestStart is not defined
[Break on this error] }else{this[a]=eval(b);
Anybody with clues, any pointers will be highly regarded.
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 28 Oct 2010, 02:52 PM
Ok. Solved by implementing the two script functions onRequestStart & onResponseEnd and it started to work. Now, the issue of the continuos Ajax request is disturbing the user input. I want to be able to stop further processing if the JobDate from the grid's row and the current SelectedDate of the Scheduler is same.