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.
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)
{
}
}