Server tags in OnDateSelected event of RadDatePicker

4 posts, 0 answers
  1. Ritesh
    Ritesh avatar
    1 posts
    Member since:
    Dec 2008

    Posted 23 Dec 2008 Link to this post

    I am trying to define a RadDatePicker as shown below:

      <telerik:RadDatePicker id="RadDatePicker1" Runat="server" MinDate="2006/1/1" width="150px"  RadControlsDir="~/Control/RadControls/">                               
        <ClientEvents OnDateSelected='<%=Me.MyJavascriptFunction%>'></ClientEvents>

    the <%=Me.MyJavascriptFunction%> calls a function and retrieves an appropriate javascript function name dynamically. But it seems I can not define it like this because in the page source I see <%=Me.MyJavascriptFunction%> is not being replaced. Can i achieve this some other way? I am trying to call a javascript function and use my application's Ajax Framework. The requirement is there should be no postbacks.
  2. Dimo
    Dimo avatar
    8454 posts

    Posted 24 Dec 2008 Link to this post

    Hello Ritesh,

    You can set the OnDateSelected property at runtime. Then it will work.

    By the way, RadControls for ASP.NET AJAX do not have a RadControlsDir property.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Mahtab
    Mahtab avatar
    4 posts
    Member since:
    Oct 2012

    Posted 08 Nov 2012 Link to this post

    Can u please provide the syntax to set the OnDateSelected property at runtime?
    n how to pass anothercontrol.clientID as parameter to OnDateSelected property from runtime.

    Its an urgent need, please help as soon as possible.
  4. Vasil
    Vasil avatar
    1635 posts

    Posted 13 Nov 2012 Link to this post

    Hi Mahtab,

    C# code that should work for attaching the OnDateSelected dynamically:

    protected void Page_Load(object sender, EventArgs e)
        RadDatePicker1.ClientEvents.OnDateSelected = String.Format("OnDateSelected_{0}", RadDatePicker1.ClientID);

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top