Display label on event OnDateSelected

2 posts, 0 answers
  1. RB
    RB avatar
    126 posts
    Member since:
    Dec 2013

    Posted 01 Aug 2014 Link to this post

    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) {
                   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) {
    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.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Aug 2014 in reply to RB Link to this post

    Hi RB,

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

    function (data) {
        var savedLabel = document.getElementById("savedLabel");
        savedLabel.style.display = "block";

  3. DevCraft R3 2016 release webinar banner
Back to Top