create a unique OnDateSelected client event for all instances

4 posts, 0 answers
  1. Attila Forczek
    Attila Forczek avatar
    1 posts
    Member since:
    Apr 2008

    Posted 05 Sep 2008 Link to this post

    Hi!

    I created an own DateCombo user control where I put a RadDatePicker control.
    I want to use more instances of this own user control  on one page and I want to handle unique OnDateSelected client event for all instances.
    I tried to use inline expression in the front code but as I experienced it was not resolved at the telerik:RadDatePicker (but in the javascript block it was)

    <script type="text/javascript">
            function OnDateSelected_<%= ClientID %>(sender, eventArgs)
            {
    ......
    }

    </script>

     <telerik:RadDatePicker id="RadDatePicker1"
                              Runat="server"
                              SharedCalendarID="sharedCalendar"
                              AutoPostBack="false"
                              Width="100px"  CssClass="" >
                      <ClientEvents OnDateSelected="OnDateSelected_<%= RadDatePicker1.ClientID %>" />       
                                                                                                                                     
                  <Calendar EnableEmbeddedSkins="false" Skin="MySkin" runat="server">
                  </Calendar>
                  <DateInput ID="radDateInput1" runat="server" EnableEmbeddedSkins="false" Skin="MySkin" DateFormat="d">
                  </DateInput>
                  <DatePopupButton ImageUrl= "../Styles/telerik/Skins/MySkin/Calendar/datePickerPopup.gif" CssClass="DateInputImage"
                                   HoverImageUrl="../Styles/telerik/Skins/MySkin/Calendar/datePickerPopupHover.gif" />                                               
       </telerik:RadDatePicker>


    Does anybody have any idea  how can I solve this problem?
    thx in advance
    Zsolt

  2. Plamen Peshev
    Admin
    Plamen Peshev avatar
    886 posts

    Posted 08 Sep 2008 Link to this post

    Hello Attila,


    We have addressed your question in the forum post you have opened on the same topic.


    Best wishes,
    Plamen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  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

    Can you please mention the URL link of the solution for this question.
    I too facing the same issue and wanna get a solution urgently.

    Thanks..
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 12 Nov 2012 Link to this post

    Hello Mahtab,

    The solution is to set the event in the code behind:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadDatePicker1.ClientEvents.OnDateSelected = String.Format("OnDateSelected_{0}", RadDatePicker1.ClientID);
    }


    Regards,
    Vasil
    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