Running client script to print web page

4 posts, 0 answers
  1. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 29 Dec 2009 Link to this post

    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>

     

     

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 30 Dec 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 31 Dec 2009 Link to this post

    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.
  5. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 31 Dec 2009 Link to this post

    <duplicate post - deleted>
Back to Top