Adding OnDateSelected() event method dynamically for RadDatePicker

3 posts, 0 answers
  1. Meenakshi Nagalingam
    Meenakshi Nagalingam avatar
    53 posts
    Member since:
    Aug 2009

    Posted 23 Dec 2009 Link to this post

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

    Posted 23 Dec 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mahtab
    Mahtab avatar
    4 posts
    Member since:
    Oct 2012

    Posted 08 Nov 2012 Link to this post

    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... :)
Back to Top