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

Adding OnDateSelected() event method dynamically for RadDatePicker

2 Answers 269 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Meenakshi Nagalingam
Top achievements
Rank 1
Meenakshi Nagalingam asked on 23 Dec 2009, 01:16 PM
Hi,

I am having the RadDatePicker control inside the rad grid. I want to add the "OnDateSelected" client event dynamically in code behind based on some conditions.

I have the following code in my grid's ItemDataBound,

 

string paramVal = "('" + isConditionalTimeFrame + "','" + imgExpandButton.UniqueID + "','" + grdViewRegistries.ClientID + "')";

 

if

 

(isConditionalTimeFrame)

 

{

 

    dtpLastEventDate.ClientEvents.OnDateSelected =

"dtpLastEventDate_OnDateSelected" + paramVal;
}

This is my java script,

 

function

 

dtpLastEventDate_OnDateSelected(isConditionalTimeFrame, imgExpandButtonUniqueID, grdViewRegistriesClientID)

 

{
    

 

}

The issue is, the script is executed immediately after ItemDataBound, and its not triggered when I select any date in the DatePicker.
If anybody have any idea about this, pls share with me.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Dec 2009, 01:28 PM
Hello Meenakshi,

It is not possible to add custom parameter with the OnDateSelected client event. It takes default parameters sender and eventArgs. One suggestion to achieve the scenario is save the ClientIDs in HiddenField controls and access that in client side event handler instead of passing as parameter.

-Shinu.
0
Mahtab
Top achievements
Rank 1
answered on 08 Nov 2012, 08:53 AM
I have the same requirement. Can you please show a demo or an example code snippet to understand it better.
Please provide a solution soon as its an urgent need.

Thanks... :)
Tags
Calendar
Asked by
Meenakshi Nagalingam
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mahtab
Top achievements
Rank 1
Share this question
or