RadToolBar and RadWindow Integration Using CodeBehind

3 posts, 1 answers
  1. Ahmed
    Ahmed avatar
    2 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2012 Link to this post

    Hi All,

    Is it possible to popup a RadWindow when a RadToolBarButton is clicked in code behind.
    I'm tried to do this by passing by a javascript function and then call the VB.NET function but it didn't work
    Here's my code :

            <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
                <script type="text/javascript">
                    var toolbar;
                    var ajaxManager;
                    function pageLoad() {
                        toolbar = $find("<%= RadToolBarApplication.ClientID %>");
                        ajaxManager = $find("<%=RadAjaxManager1.ClientID %>");
                    function onButtonClicked(sender, args) {
                        var commandName = args.get_item().get_commandName();
                        if (commandName == "functionJS") {
    <telerik:RadToolBar ID="RadToolBarApplication" runat="server" OnClientButtonClicked="onButtonClicked" >
               <telerik:RadToolBarButton Text="button1" CommandName="functionJS" />

    <System.Web.Services.WebMethod()> Public Sub VBFunction()
        Dim radWindow As New RadWindow
        radWindow.ID = "RadWindow8"
        radWindow.AutoSize = True
        radWindow.VisibleOnPageLoad = True
    End Sub


  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Sep 2012 Link to this post

    Hi Ahmed,

    Try the following code to achieve your scenario.

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
        <telerik:RadWindow ID="RadWindow1" NavigateUrl="Window.aspx" runat= "server"></telerik:RadWindow>

    Protected Sub RadToolBarApplication_ButtonClick(sender As Object, e As Telerik.Web.UI.RadToolBarEventArgs)
        Dim btn As RadToolBarButton = TryCast(e.Item, RadToolBarButton)
        If btn.CommandName.ToString() = "functionJS" Then
            Dim script As String = "function f(){$find(""" + RadWindow1.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
            ScriptManager.RegisterStartupScript(Page, Page.[GetType](), "RadWindow", script, True)
        End If
    End Sub

  3. DevCraft R3 2016 release webinar banner
  4. Ahmed
    Ahmed avatar
    2 posts
    Member since:
    Sep 2012

    Posted 26 Sep 2012 Link to this post

    Thanks Princy
Back to Top