Print Data Base Data ,When Click On Print Button Of rad Grid.

3 posts, 0 answers
  1. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 06 Jun 2013 Link to this post

    Hello  Telerik  folks,can You help here
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
                AutoGenerateColumns="false" onitemcommand="RadGrid1_ItemCommand">
                <MasterTableView AutoGenerateColumns="false">
                                <asp:CheckBox ID="CheckBox1" runat="server"   />
                        <telerik:GridTemplateColumn UniqueName="employeenaem" HeaderText="EmployeeName">
                                <%#Eval("Employeename") %>
                        <telerik:GridTemplateColumn UniqueName="employeeDesgination" HeaderText="EmployeeDesignation">
                        <telerik:GridTemplateColumn UniqueName="Salary" HeaderText="salary">
                                <%#Eval("EmployeeSalary") %>
            <telerik:RadButton ID="RadButton1" runat="server" Text="Print"

    protected void RadButton1_Click(object sender, EventArgs e)
            PrintDocument pd = new PrintDocument();
            foreach (GridDataItem item1 in RadGrid1.MasterTableView.Items)
                CheckBox ChkedList = (CheckBox)item1.FindControl("CheckBox1");
                if (ChkedList.Checked)
                    Index = item1.ItemIndex;

     public void  DrawImage()
            if (m_oConn.State != ConnectionState.Closed)

            m_oCmd = new MySqlCommand("select * from  printtest",m_oConn);
            DataSet ds = new DataSet();
            m_aDp = new MySqlDataAdapter(m_oCmd);
            string dempname,dempdesg;
            decimal dsalary;
            string drawString2 = string.Empty;
            Graphics g;
            Bitmap b;
            Page p;
            b = new Bitmap(790, 1050);
            g = Graphics.FromImage(b);
            p = this.Page;
            p.Response.ContentType = "image/jpeg";
            g.FillRectangle(new SolidBrush(Color.White), 0, 0, 790, 325);
            g.FillRectangle(new SolidBrush(Color.White), 0, 325, 790, 1050)
            FontFamily fm1 = new FontFamily("Consolas");
            Font drawFont = new Font(fm1, 12);
            Font drFont = new Font("Arial", 8);
            Font drFont1 = new Font("Arial", 9);
            Font drsmallFont = new Font("Arial", 8);
            Font drnarrowFont = new Font("Arial Narrow", 8);
            Font drnarrowFont1 = new Font("Verdana,sans-serif", 8);
            Font drarialblackFont = new Font("Arial Black", 10);

            SolidBrush drawBrush = new SolidBrush(Color.Black);

            PointF drawPoint = new PointF(140.0F, 290.0F);

            Pen pn = new Pen(drawBrush);
            string path = Server.MapPath("images/InfoImg.png");
            Bitmap logo = new Bitmap(path);

            Graphics gra = Graphics.FromImage(logo);
            g.DrawImage(logo, 15.0F, 30.0F);

            ImageConverter ic = new ImageConverter();

            g.DrawString("PAY TO THE ORDER OF ____" + "__________________________________________________________________", drnarrowFont1, drawBrush, 15.0F, 120.0F);
            g.DrawString(dempname + "is worked as " + dempdesg + "and erans" + dsalary, drnarrowFont1, drawBrush, 145.0F, 117.0F);
            b.Save(p.Response.OutputStream, ImageFormat.Jpeg);

    Here ...I want to print the .....Data That in database....not current document......based user select  Data-rows and then click on Print.. ...presently.  I want to print the Multiple Image files...based on user selected rows ..only one Image Show in page......I don't want to show printing information ..I want to Print ...Image files......I search many website...I am not getting results.....That why I am post the thread...
  2. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 11 Jun 2013 Link to this post

    Andrey,Thanks for your replay  ....if you say take another .....Radgrid2 in same page and  Display the .....Print page content in that ...after use your logic ....but ..can you provide  some simple ....sample to  this question it's very useful to..many folks like  me........
  3. Andrey
    Andrey avatar
    836 posts

    Posted 12 Jun 2013 Link to this post


    The previous reply was mistakenly placed in your thread. It was aimed to help another user.

    About your question I am afraid that this functionality is not available with our products and you need to implement it manually.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top