This is a migrated thread and some comments may be shown as answers.

Display label on event OnDateSelected

1 Answer 50 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 02 Aug 2014, 04:33 AM
I have a RadDatePicker, where on selection of a date, the date is saved in the DB and the user should get a message that date is saved. The RadDatePicker calls a function on its event OnDateSelected as follows(C#):

radDatePicker.ClientEvents.OnDateSelected = "function(sender, args){SaveDate(sender,args," + PriceDealProposalId + ")}";

The javascript function SaveDate successfully calls a webservice to save the date selected.

function SaveDate(sender, e, id) {      
       if (e.get_newDate() != null) {
           $.ajax({
               url: "/ajaxservice.asmx/SaveSignedDate",
               data: "{priceDealProposalId:" + id + ",proposalDate: " + JSON.stringify(e.get_newDate()) + "}",
               dataType: "json",
               type: "POST",
               contentType: "application/json;charset=utf-8",
               success: function (data) {
                   alert("saved");
               }
           });
       }
   }
The above successfully saves the value and alerts a message. Instead of an alert I want to display a text message near this RadDatePicker control which says "Saved" and disappears in a few seconds. 
For this I added a label and made it invisible as follows:
savedLabel.Attributes.Add("style", "display:none;");
How can I access this label in the success part of the ajax call. On success I want to make the label visible so that user knows the date as saved.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Aug 2014, 05:22 AM
Hi RB,

Please try the below JavaScript code snippet in success part of the Ajax call.

JavaScript:
...
success:
function (data) {
    alert("saved");
    var savedLabel = document.getElementById("savedLabel");
    savedLabel.style.display = "block";
}
...

Thanks,
Shinu.
Tags
Calendar
Asked by
RB
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or