Javascript Issue

Thread is closed for posting
4 posts, 0 answers
  1. Ramesh Pudhucode
    Ramesh Pudhucode avatar
    7 posts
    Member since:
    Oct 2009

    Posted 09 Oct 2009 Link to this post

    Hello,

    I am populating the Telerik RadDatePicker field with a Date value. Then I run a JavaScript Confirm() statement asking the user to choose "ok" or "Cancel". When the message box  pops up  asking for user confirmation, the RadDatePicker field gets cleared.  After the user chooses "ok" or "cancel", the RadDatePicker value is populated again.

    How can I make sure that the Rad DatePicker field, is populated even when the Confirm() message box pops on the screen.

    Thanks

    Ramesh
  2. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 15 Oct 2009 Link to this post

    Hello Ramesh,

    I am not sure I understand your question. Could you, please clarify the exact sequence in your scenario. What client events are you using? If you can also paste some code, we can assist you better.

    All the best,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ramesh Pudhucode
    Ramesh Pudhucode avatar
    7 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    Hello,

    Here are the details.

    In Code behind, based on a scenario, I am calling a JavaScript Function to display a popup confirm box

    Code Behind Code:
        if (udpr.GetUserPageRole("Work Order") <= 2) /* Means user only has View/Update access only */

     

           {

     


            ScriptManager
    .RegisterStartupScript(this, this.GetType(), "popup", "redirectToNewWorkOrder('" + "0" + "');", true);

     

            }

    JavaScript Code:
           function redirectToNewWorkOrder(url)

     

                {

     

                    var availHeight = 300;

     

     

                    var availWidth = 200;

     

     

     

                    if(confirm("There are no Work Orders for this Location. Do you want to create a new Work Order?"))

     

                        {

                                window.location =

    "NewWorkOrder.aspx?WorkOrderNum=" + url ;

     

     

                        }

                }
     
    HTML Code:

     

     

            <tr>

     

     

     

     

     

     

                    <td>

     

     

     

     

     

     

                  <asp:Label ID="LblDateFrom" AccessKey="U" runat="server" Text="Date               From"     AssociatedControlID="RadDateFromPicker"     style="position:relative;margin-left:3px;" />

     

     

     

     

     

     

                    </td>

     

     

     

     

     

     

                        <td>

     

     

     

     

     

     

                            <telerik:RadDatePicker id="RadDateFromPicker" AutoPostBack="false" runat = "Server" BorderWidth="1"         EnableTyping="false" width="115px" >

     

     

     

     

     

     

                            </telerik:RadDatePicker>

     

     

     

     

     

     

                        </td>

     

     

     

     

     

     

     

     



    Problem:

    The Problem is the value in "RadDateFromPicker" gets cleared temporarily when the java function "redirectToNewWorkOrder" is called. After the user closes the confirm popup box, the value in "RadDateFromPicker" is populated again on the web page. I also 
    tried making AutoPostBack= "false".  But it did not help.

                    
    Please advise
    Ramesh

  5. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 19 Oct 2009 Link to this post

    Hello Ramesh,

    I tested the scenario you are describing with RadDatePicker from the version you specified to be using. RadDatePicker does not clear the selected value when the confirm shows up on my site. Attached is a screenshot. The behavior you are observing is probably caused by some other logic.

    Regards,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top