RADDock button event

2 posts, 0 answers
  1. Nareshkumar
    Nareshkumar avatar
    5 posts
    Member since:
    Oct 2013

    Posted 09 Dec 2013 Link to this post

    i have user control in RADDock, In Raddock i have Gear Button. If i click gear button it will navigate to new page, like wise i have button in usercontrol if i click  it,  navigate to same page. how should i fire button event in usercontrol when i click gear button. I am loading RADDock Dynamically
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Dec 2013 Link to this post

    Hi Nareshkumar,

    Please have a look into the following code snippet to achieve your scenario.

    ASCX:
    <telerik:RadButton ID="RadButton1" runat="server" Text="Click" AutoPostBack="false" ButtonType="LinkButton"
        OnClientClicked="OnClientClicked">
    </telerik:RadButton>

    ASPX Page C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        //dynamically created radbock
        RadDock RadDock1 = new RadDock();
        //dynamically created radbutton
        RadButton radbutton = new RadButton();
        radbutton.Text = "Button1";
        radbutton.ButtonType = RadButtonType.LinkButton;
        radbutton.OnClientClicked = "OnClientClicked";
        //adding dynamically created button to raddock
        RadDock1.ContentContainer.Controls.Add(radbutton);
        //accessing usercontrol
        Control usercontrol = new Control();
        usercontrol = LoadControl("WebUserControl.ascx");
        //adding usercontrol to raddock
        RadDock1.ContentContainer.Controls.Add(usercontrol);
        this.form1.Controls.Add(RadDock1);
    }

    ASPX Page JavaScript:
    <script type="text/javascript">
        function OnClientClicked(sender, args) {
            sender.set_navigateUrl("Default2.aspx");
        }
    </script>

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