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

create a unique OnDateSelected client event for all instances

3 Answers 64 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Attila Forczek
Top achievements
Rank 1
Attila Forczek asked on 05 Sep 2008, 10:16 AM
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

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 08 Sep 2008, 10:02 AM
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.
0
Mahtab
Top achievements
Rank 1
answered on 08 Nov 2012, 08:59 AM
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..
0
Vasil
Telerik team
answered on 12 Nov 2012, 02:01 PM
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.
Tags
Calendar
Asked by
Attila Forczek
Top achievements
Rank 1
Answers by
Missing User
Mahtab
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or