i want to convert the form into preview and print it
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
font-size: xx-large;
color: #3399FF;
text-decoration: underline;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" runat="server" Height="78px" ImageUrl="~/Logo.jpg"
Width="107px" />
<span class="style1"><strong><em> ID Card</em></strong></span><strong><em><br
class="style1" />
</em></strong>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:Label ID="lblname" runat="server" Text="Name:" style="font-size: large"></asp:Label>
<asp:TextBox ID="txtname" runat="server" Height="28px" Width="210px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtname" ErrorMessage="First name is empty"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="lblclass" runat="server" Text="Class:" style="font-size: large"></asp:Label>
<asp:TextBox ID="txtclasss" runat="server" Height="30px" Width="206px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtname" ErrorMessage="First name is empty"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="lbldob" runat="server" Text="Date Of Birth:"
style="font-size: large"></asp:Label>
<asp:TextBox ID="Txtdob" runat="server" Height="25px" Width="196px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="Txtdob" ErrorMessage="only integer"></asp:RequiredFieldValidator>
<br />
<br />
<br />
<asp:Label ID="lblemail" runat="server" style="font-size: large"
Text="Email Id:"></asp:Label>
<asp:TextBox ID="txtemail" runat="server" Height="28px" Width="194px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtname" ErrorMessage="should not be empty"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="txtemail" ErrorMessage="invalid"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<br />
<br />
<asp:Label ID="lblphone" runat="server" style="font-size: large"
Text="PhoneNo:"></asp:Label>
<asp:TextBox ID="txtphone" runat="server" Width="198px" Height="29px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txtphone" ErrorMessage="phone no is empty"></asp:RequiredFieldValidator>
<br />
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
ControlToValidate="txtphone" ErrorMessage="incomplete phone no"
ValidationExpression="\d{10}"></asp:RegularExpressionValidator>
<br />
<asp:Label ID="lblAddress" runat="server" style="font-size: large"
Text="Address:"></asp:Label>
<asp:TextBox ID="txtaddress" runat="server" Height="26px" Width="202px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="txtaddress" ErrorMessage="address is empty"></asp:RequiredFieldValidator>
<br />
<asp:Label ID="Label1" runat="server" Text="Roll No"></asp:Label>
<asp:TextBox ID="txtrollno" runat="server" Height="30px" Width="196px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="txtrollno" ErrorMessage="No Special Character"></asp:RequiredFieldValidator>
<br />
<br />
<br />
<asp:Button ID="Btnsubmit" runat="server" BackColor="#FFFFCC"
BorderColor="Black" Height="37px" Text="Submit" Width="183px" OnClick="Btnsubmit_Click"/>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ID_Card : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Btnsubmit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-QJVUM5G\SQLEXPRESS;Initial Catalog=onlineadmission;Integrated Security=True");
SqlCommand cmd = new SqlCommand("insert into IDCARD(name,class,DOB,Email,PhoneNo,Address,RollNo) values('" + txtname.Text + "','" + txtclasss.Text + "','" + Txtdob.Text + "','" + txtemail.Text + "','" + txtphone.Text + "','" + txtaddress.Text + "','" + txtrollno.Text + "') ", con);
con.Open();
cmd.Parameters.AddWithValue("@name", txtname.Text);
cmd.Parameters.AddWithValue("@class", txtclasss.Text);
cmd.Parameters.AddWithValue("@DOB", Txtdob.Text);
cmd.Parameters.AddWithValue("@Email", txtemail.Text);
cmd.Parameters.AddWithValue("@PhoneNo", txtphone.Text);
cmd.Parameters.AddWithValue("@Address", txtaddress.Text);
cmd.Parameters.AddWithValue("@RollNo", txtrollno.Text);
if (cmd.ExecuteNonQuery() > 0)
{
Label2.ForeColor = System.Drawing.Color.Green;
Label2.Text = "Records added successfully";
}
else
{
Label2.ForeColor = System.Drawing.Color.Red;
Label2.Text = "Records not added ";
}
con.Close();
}
}