Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web form that I want the user to print once the information has been inputted into the textboxes. Can this be done? I have looked every where for this. Here is my code. If I have something wrong let me know.

C#
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing.Printing;

public partial class FinancialProfileFormA : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {

        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PassConnectionString"].ConnectionString);
        con.Open();


        string insCmd = "Insert into TableFIN (FINYR, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP) values (@FINYR, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @SCHOLARSHI, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP)";
        SqlCommand insertUser = new SqlCommand(insCmd, con);
        insertUser.Parameters.AddWithValue("@FINYR", TextBoxCYF.Text);
        insertUser.Parameters.AddWithValue("@INSTRUCTIO", TextBoxInstr.Text);
        insertUser.Parameters.AddWithValue("@RESEARCH", TextBoxRes.Text);
        insertUser.Parameters.AddWithValue("@PUBLIC_SER", TextBoxPubS.Text);
        insertUser.Parameters.AddWithValue("@ACADEMIC_S", TextBoxAcad.Text);
        insertUser.Parameters.AddWithValue("@STUDENT_SE", TextBoxStudS.Text);
        insertUser.Parameters.AddWithValue("@INSTITUTIO", TextBoxInstiS.Text);
        insertUser.Parameters.AddWithValue("@PHYSICAL_P", TextBoxOperM.Text);
        insertUser.Parameters.AddWithValue("@SCHOLARSHI", TextBoxSFEDA.Text);
        insertUser.Parameters.AddWithValue("@AUXILIARY_", TextBoxAuxE.Text);
        insertUser.Parameters.AddWithValue("@HOSPITALS", TextBoxHosS.Text);
        insertUser.Parameters.AddWithValue("@INDEPENDEN", TextBoxIndeO.Text);
        insertUser.Parameters.AddWithValue("@OTHEREXP", TextBoxOED.Text);
        

        try
        {
            insertUser.ExecuteNonQuery();
            con.Close();
            Response.Redirect("FinancialIndicatorsForm.aspx");
        }
        catch (Exception er)
        {
            Response.Write("You Have Successfully Submitted the Information!!!");
        }
        finally
        {

        }
    }
   public class PCPrint : System.Drawing.Printing.PrintDocument
    {
        
    }
   protected void ButtonPrint_Click(object sender, EventArgs e)
   {
       
   }
}
Posted

1 solution

 
Share this answer
 
Comments
Maciej Los 6-Jun-13 17:45pm    
Nice collection of links ;)
+5!
ridoy 7-Jun-13 1:34am    
Thanks Maciej..:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900