Radtoolbar click event..

2 posts, 0 answers
  1. geetha priya
    geetha priya avatar
    25 posts
    Member since:
    May 2010

    Posted 06 Dec 2010 Link to this post

    Hi

    i am using radtoolbar in my page. i want to load a page inside an iframe on toolbar button's click.
    here its my code:
      <apex:RadToolBarButton Text="Chat History" runat="server" ImageUrl="images/chat.png"  CommandName="reports"  Enabled="true" ImagePosition="AboveText" NavigateUrl="reports.aspx"  Target="targetFrame">
       </apex:RadToolBarButton>
      <apex:RadToolBarButton Text="Chat History" runat="server" ImageUrl="images/chat.png"  CommandName="reports"  Enabled="true" ImagePosition="AboveText" NavigateUrl="reports.aspx"  Target="targetFrame">
       </apex:RadToolBarButton>
      <apex:RadToolBarButton Text="Chat History" runat="server" ImageUrl="images/chat.png"  CommandName="reports"  Enabled="true" ImagePosition="AboveText" NavigateUrl="reports.aspx"  Target="targetFrame">
       </apex:RadToolBarButton>
    <telerik: RadToolBar ID="maintoolbar" runat="server" >
    <items>
    <telerik:RadToolBarButton Text="chat history" NavigateUrl="reports.aspx"  Target="targetFrame"></telerik:RadToolBarButton>
    </items>
    </telerik:RadToolBar>

      <iframe  id="targetFrame" runat="server">
    it works fine, but i want to pass arguments to the iframe from my main page. how can i do this?

    thanks in advance,
    geetha.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Dec 2010 Link to this post

    Hello Geetha,
    Another way to accomplish the same is attaching OnClientButtonClicked event and set the iframe source from there instead of setting the NavigateUrl. In this method, you can easily set the url parameter from client side (by accessing corresponding server control and getting the value). Please try the following client side code and see whether it suits your need. 

    JavaScript:
    function OnClientButtonClicked(sender, args)
    {
        var textBox1 = document.getElementById("TextBox1");
        var value = textBox1.value;
        var ifrm = document.getElementById("targetFrame");
        ifrm.src = 'itemcolor.aspx?id=' + value;
    }

    aspx:
    <div>
       <telerik:RadToolBar ID="maintoolbar" runat="server" OnClientButtonClicked="OnClientButtonClicked">
                <Items>
                    <telerik:RadToolBarButton Text="chat history"  >
                    </telerik:RadToolBarButton>
                </Items>
    </telerik:RadToolBar>
     <asp:TextBox ID="TextBox1" runat="server" Text="hi"></asp:TextBox>
     <iframe name="targetFrame" id="targetFrame" runat="server"></iframe>
    </div>


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