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

2 posts, 0 answers
  1. Code
    Code avatar
    9 posts
    Member since:
    Aug 2013

    Posted 15 Aug 2013 Link to this post

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

    Posted 15 Aug 2013 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top