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

Radtoolbar click event..

1 Answer 151 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
geetha priya
Top achievements
Rank 1
geetha priya asked on 06 Dec 2010, 08:24 AM
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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Dec 2010, 01:47 PM
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.
Tags
ToolBar
Asked by
geetha priya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or