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

RADDock button event

1 Answer 11 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Nareshkumar
Top achievements
Rank 1
Nareshkumar asked on 09 Dec 2013, 12:40 PM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Dec 2013, 04:19 AM
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.
Tags
Dock
Asked by
Nareshkumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or