Hi muhammad12,
Save the value in Session and redirect after saving.
Then retrive the value from Session and set in Label for print.
Please refer below sample.
HTML
Default
<table>
<tr>
<td colspan="3"><asp:Image ID="imageLogo" runat="server" ImageUrl="~/india.png" Width="40" Height="40" /></td>
<td style="float: right">Tracking ID:<asp:Label ID="lblTrackingId" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="4">To:
<br />
Mr.<asp:Label ID="lblName" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="4">Finance<asp:Label ID="lblFinance" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="4">house no:<asp:Label ID="lblHouseno" runat="server"></asp:Label>
<br />
street no:<asp:Label ID="lblStreetno" runat="server"></asp:Label>
<br />
City:<asp:Label ID="lblCity" runat="server"></asp:Label><br />
<br />
<br />
</td>
</tr>
<tr>
<td colspan="3">Item Name</td>
<td><asp:Label ID="lblItemName" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="3">Type</td>
<td><asp:Label ID="lblType" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="3">Quantity</td>
<td><asp:Label ID="lblQuantity" runat="server"></asp:Label></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2" style="float: right">From:</td>
</tr>
<tr>
<td colspan="4">
<p style="text-align: right;">
<asp:Label ID="lblFromName" runat="server" Style="text-align: right"></asp:Label></p>
<p style="text-align: right;"><asp:Label ID="lblDesignation" runat="server"></asp:Label>
</p>
<p style="text-align: right"><asp:Label ID="lblFromAddres" runat="server"></asp:Label></p>
</td>
</tr>
</table>
Home
<table>
<tr><td>TrackingId:<asp:TextBox ID="txtTrackingId" runat="server" OnTextChanged="txtTrackingId_TextChanged"></asp:TextBox></td></tr>
<tr><td>Name:<asp:TextBox ID="txtName" runat="server"></asp:TextBox></td></tr>
<tr><td>Finance:<asp:TextBox ID="txtFinance" runat="server"></asp:TextBox></td></tr>
<tr><td>House No:<asp:TextBox ID="txtHouseno" runat="server"></asp:TextBox></td></tr>
<tr><td>Street No:<asp:TextBox ID="txtStreetno" runat="server"></asp:TextBox></td></tr>
<tr><td>City:<asp:TextBox ID="txtCity" runat="server"></asp:TextBox></td></tr>
<tr><td>Item Name:<asp:TextBox ID="txtItemName" runat="server"></asp:TextBox></td></tr>
<tr><td>Type<asp:TextBox ID="txtType" runat="server"></asp:TextBox></td></tr>
<tr><td>Quantity:<asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox></td></tr>
<tr><td>FromName:<asp:TextBox ID="txtFromName" runat="server"></asp:TextBox></td></tr>
<tr><td>Designation:<asp:TextBox ID="txtDesignation" runat="server"></asp:TextBox></td></tr>
<tr><td>FromAddres:<asp:TextBox ID="txtFromAddres" runat="server"></asp:TextBox></td></tr>
<tr><td><asp:Button ID="btnSave" runat="server" Text="Save" OnClick="Save"/></td></tr>
</table>
Namespace
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
Default
protected void Save(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("TrackingId");
dt.Columns.Add("Name");
dt.Columns.Add("Finance");
dt.Columns.Add("Houseno");
dt.Columns.Add("Streetno");
dt.Columns.Add("City");
dt.Columns.Add("ItemName");
dt.Columns.Add("Type");
dt.Columns.Add("Quantity");
dt.Columns.Add("FromName");
dt.Columns.Add("Designation");
dt.Columns.Add("FromAddres");
dt.Rows.Add(txtTrackingId.Text,txtName.Text,txtFinance.Text,txtHouseno.Text,txtStreetno.Text,txtCity.Text,txtItemName.Text,txtType.Text,txtQuantity.Text,txtFromName.Text,txtDesignation.Text,txtFromAddres.Text);
Session["Data"] = dt;
Response.Redirect("~/Default.aspx");
}
Home
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = Session["Data"] as DataTable;
lblTrackingId.Text = dt.Rows[0]["TrackingId"].ToString();
lblName.Text = dt.Rows[0]["Name"].ToString();
lblFinance.Text = dt.Rows[0]["Finance"].ToString();
lblHouseno.Text = dt.Rows[0]["HouseNo"].ToString();
lblStreetno.Text = dt.Rows[0]["StreetNo"].ToString();
lblCity.Text = dt.Rows[0]["City"].ToString();
lblItemName.Text = dt.Rows[0]["ItemName"].ToString();
lblType.Text = dt.Rows[0]["Type"].ToString();
lblQuantity.Text= dt.Rows[0]["Quantity"].ToString();
lblFromName.Text = dt.Rows[0]["FromName"].ToString();
lblDesignation.Text = dt.Rows[0]["Designation"].ToString();
lblFromAddres.Text = dt.Rows[0]["FromAddres"].ToString();
}
}
VB.Net
Default
Protected Sub Save(ByVal sender As Object, ByVal e As EventArgs)
Dim dt As DataTable = New DataTable()
dt.Columns.Add("TrackingId")
dt.Columns.Add("Name")
dt.Columns.Add("Finance")
dt.Columns.Add("Houseno")
dt.Columns.Add("Streetno")
dt.Columns.Add("City")
dt.Columns.Add("ItemName")
dt.Columns.Add("Type")
dt.Columns.Add("Quantity")
dt.Columns.Add("FromName")
dt.Columns.Add("Designation")
dt.Columns.Add("FromAddres")
dt.Rows.Add(txtTrackingId.Text, txtName.Text, txtFinance.Text, txtHouseno.Text, txtStreetno.Text, txtCity.Text, txtItemName.Text, txtType.Text, txtQuantity.Text, txtFromName.Text, txtDesignation.Text, txtFromAddres.Text)
Session("Data") = dt
Response.Redirect("~/Default.aspx")
End Sub
Home
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As DataTable = TryCast(Session("Data"), DataTable)
lblTrackingId.Text = dt.Rows(0)("TrackingId").ToString()
lblName.Text = dt.Rows(0)("Name").ToString()
lblFinance.Text = dt.Rows(0)("Finance").ToString()
lblHouseno.Text = dt.Rows(0)("HouseNo").ToString()
lblStreetno.Text = dt.Rows(0)("StreetNo").ToString()
lblCity.Text = dt.Rows(0)("City").ToString()
lblItemName.Text = dt.Rows(0)("ItemName").ToString()
lblType.Text = dt.Rows(0)("Type").ToString()
lblQuantity.Text = dt.Rows(0)("Quantity").ToString()
lblFromName.Text = dt.Rows(0)("FromName").ToString()
lblDesignation.Text = dt.Rows(0)("Designation").ToString()
lblFromAddres.Text = dt.Rows(0)("FromAddres").ToString()
End If
End Sub
Screenshot