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

Save state after Print

2 Answers 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Johnny asked on 27 Aug 2012, 08:19 PM
Hi, regards from Costa Rica,
We got Reporting Q2 20011. We are developing a track system of Courses and Record of our Diplomas.
Each Diploma has an ID, that identify: student, course, and Instructor.
There´s a table CONTROL DIPLOMA, with Course Data, Diploma ID, State Of Diploma., Student ID.
Also there ´s  a State Catalog, with values : No tPrinted, Printed, RePrinted, Override.

Printing Diplomas, I tried without success, when the user press my custom Print Button, catch the event and SAVE the state of the Diploma in a table CONTROL DIPLOMA. I can´t do it, because, the update code are at Server side, but we get launch Printer Window with javascript code recomended to use Custom Print Button.

Any ideas ?


P.D: Sorry, my english, my maternal language is ESPAÑOL, :-) Pura Vida.




2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 30 Aug 2012, 11:09 AM
Hi Johnny,

We're not sure we understand your scenario completely. This table control, is that a Table item in Telerik Reporting or some other control on your aspx page? And you want to update one of its cells to reflect that a user has invoked a print via the PrintReport Client-Side API method? In such case you need to find the element you want to update via javascript as well and set its value. If we use asp:Label for simplicity, the code could be something like this:

<telerik:ReportViewer runat="server" id="ReportViewer1" Height="570px"
            Width="780px"></telerik:ReportViewer>   
        <asp:Label runat="server" ID="Label1"></asp:Label>
         <script type="text/javascript">
            var viewer1 = <%= ReportViewer1.ClientID %>;
            viewer1.OnPrintReportLoadedOriginal = viewer1.OnPrintReportLoaded;
             
            viewer1.OnPrint = function()
            {
                UpdateStatusLabel("Preparing the report to print....");
                this.PrintReport();
            };
             
            viewer1.OnPrintReportLoaded = function()
            {
                viewer1.OnPrintReportLoadedOriginal();
                UpdateStatusLabel("The Report has been printed");
            }  
             
            function UpdateStatusLabel(msg)
            {
                var label = document.getElementById('<%=Label1.ClientID %>');
                label.innerHTML = msg;
            }                 
             
         </script>


All the best,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Johnny
Top achievements
Rank 1
answered on 30 Aug 2012, 07:42 PM
Hi Steve,
Thanks for your answer. Table Control its  a DataBase Table, I want  to update   State column 
from that database table, after press Print Button.
I need some "FLAG"  that help me to know if user print the Diploma or not. Using that "flag" i can make database update when user press my custom "close" button in the WebForm.

 I will try your code.

:-)

regards
Johnny Alberto
Tags
General Discussions
Asked by
Johnny
Top achievements
Rank 1
Answers by
Steve
Telerik team
Johnny
Top achievements
Rank 1
Share this question
or