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

how to add a event to a telerik control from a master page

1 Answer 26 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Code
Top achievements
Rank 1
Code asked on 15 Aug 2013, 02:10 PM
If I add the event to the RadDatePicker control then obviously it works

<telerik:RadDatePicker runat="server" ID="MyRadDatePicker" ClientEvents-OnDateSelected="clientEvent" />


But My question is how do I add the event "ClientEvents-OnDateSelected" from the code behind of my master page when the radDatePicker is in a custom control and that control is on the master page?

I tried this but it wont work?

protected void Page_Load(object sender, EventArgs e)
{
UC1MyCustomControl.FindControl("MyRadDatePicker").ClientEvents-OnDateSelected="clientEvent";
 
}

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 16 Aug 2013, 04:08 AM
Hi Code,

I have tried the same scenario using one User Control. Please try the following code snippet.

UserControl:
<telerik:RadDatePicker runat="server" ID="RadDatePicker1"></telerik:RadDatePicker>
<script type="text/javascript">
    function OnDateSelected1(sender, args) {
        alert("Fired");
}
</script>

Master Page code

MasterPage C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadDatePicker rdpTest = (RadDatePicker)WebUserControl1.FindControl("RadDatePicker1");
    rdpTest.ClientEvents.OnDateSelected = "OnDateSelected1";
 
}

Thanks,
Shinu.

Tags
Calendar
Asked by
Code
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or