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

Running client script to print web page

3 Answers 82 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Tomica
Top achievements
Rank 2
Tomica asked on 29 Dec 2009, 04:06 PM
My existing application uses RAD toolbars to run various server-side functions.

I now have a need to add a button that will print the current page, which I think would be a simple JavaScript "document.print()".

I've tried the following example copied from your documentation, just to teach myself how to connect to the client-side, which I have never learned, nor can I invest much in JavaScript.

Nothing happens, and I don't know why. I am using VS2008 on Windows Vista with IE8, all current updates, and the latest Q3 release of RAD/Ajax controls.

OOPS!, Sorry didn't notice the Format Code Block option before posting. TPG

 

<

 

script type="text/javascript">   (note VS2008 tells me a "type" is required, so I changed the script here)

 

 

 

function OnClientButtonClicked(sender, args) {

 

 

 

var button = args.get_item();

 

alert(button.get_text());

}

 

</

 

script>

 

<

 

 

telerik:RadToolBar id="RadToolBar1" runat="server" Orientation="Horizontal" OnClientButtonClicked="OnClientButtonClicked">

 

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

 

<Items>

 

 

 

<telerik:RadToolBarButton Text="button1" runat="server"></telerik:RadToolBarButton>

 

 

 

<telerik:RadToolBarDropDown Text="dropdown" runat="server">

 

 

 

<Buttons>

 

 

 

<telerik:RadToolBarButton Text="Button2" runat="server"></telerik:RadToolBarButton>

 

 

 

</Buttons>

 

 

 

</telerik:RadToolBarDropDown>

 

 

 

</Items>

 

</

 

 

telerik:RadToolBar>

 

 

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 30 Dec 2009, 02:08 PM
Hi Tom,

So the ClientButtonClicked event of the toolbar is fired as expected, right?

Greetings,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tomica
Top achievements
Rank 2
answered on 31 Dec 2009, 10:18 PM
It did not work as expected on the page I intended to use it on.

Since you asked a very logical question, I decided that maybe I should try it in a cleaner context, on a new page.

It does work.

I know now there is a conflict with another toolbar on the page, and that is a different issue for me to track down.

Case closed.
0
Tomica
Top achievements
Rank 2
answered on 31 Dec 2009, 10:19 PM
<duplicate post - deleted>
Tags
ToolBar
Asked by
Tomica
Top achievements
Rank 2
Answers by
Yana
Telerik team
Tomica
Top achievements
Rank 2
Share this question
or