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

Javascript Issue

3 Answers 48 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Ramesh Pudhucode
Top achievements
Rank 1
Ramesh Pudhucode asked on 09 Oct 2009, 06:53 PM
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

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 15 Oct 2009, 07:56 AM
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.
0
Ramesh Pudhucode
Top achievements
Rank 1
answered on 15 Oct 2009, 12:34 PM

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

0
Veli
Telerik team
answered on 19 Oct 2009, 08:34 AM
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.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Ramesh Pudhucode
Top achievements
Rank 1
Answers by
Veli
Telerik team
Ramesh Pudhucode
Top achievements
Rank 1
Share this question
or