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

DateInput onclick

3 Answers 135 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Moon
Top achievements
Rank 2
Moon asked on 30 Oct 2008, 09:57 PM
I was looking at this example:
http://demos.telerik.com/aspnet/prometheus/Calendar/Examples/DatePicker/CustomPopup/DefaultCS.aspx

It has this:

           <DateInput onclick="ToggleSecondPopup()" DateFormat="D">
            </DateInput>


I want to have the user pop up the calendar when they click the date input field.

but I tried this in codebehind:
 RadDatePicker1.DateInput.Attributes.Add("onclick", "PopupCalendar()")

And it doesn't work. Also, the DateInput.OnClick attribute doesn't exist.

How do I do this in codebehind?


My javascript is:

        <script type="text/javascript">
        function PopupCalendar()
        {
            $find("<%= Raddatepicker1.ClientID %>").showPopup();
        }
        </script>

thanks.

3 Answers, 1 is accepted

Sort by
0
Moon
Top achievements
Rank 2
answered on 30 Oct 2008, 10:20 PM
Nevermind. The above works.

I was just erroring before it got set, so thought it was failing.

thanks.
0
Tu
Top achievements
Rank 1
answered on 19 Nov 2008, 04:50 PM
I have the same trouble , but I still can't solve it . Can you post your aspx and code behind  ??? I want to figure out my trouble.. Thanks !
0
Shinu
Top achievements
Rank 2
answered on 20 Nov 2008, 05:53 AM
Hi Tu,

Try out the following code snippet to achieve the desired scenario.

ASPX:
 <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
        </telerik:RadDatePicker> 

CS:
 protected void Page_Load(object sender, EventArgs e) 
    { 
        RadDatePicker1.DateInput.Attributes.Add("OnClick", "ShowPopUp();");
    } 

JS:
<script type="text/javascript" > 
 
   function ShowPopUp() 
   { 
       $find("<%= RadDatePicker1.ClientID %>").showPopup(); 
   } 
<script /> 


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