You can pass the result in a query string while using a button click and for best possible approach always encrypt the query string values and decrypt in your second page load event and then assign the value to the textbox shown in second page.
Let me know if you still have any doubts.
<head>
<script type="text/javascript">
var total=0;
var Total_store = document.getElementById("total_store");
function OnChangeCheckbox (checkbox,var sol1,var sol2) {
if (checkbox.checked) {
total=sol+sol2+total;
Total_store.value=total;
alert ("The check box is checked.");
}
else {
//add negative test cases for uncheck to decrease the total count
alert ("The check box is not checked.");
}
}
var Total_store = document.getElementById("total_store");
</script>
</head>
<body>
<input id="checkbox1" onclick="OnChangeCheckbox (this,document.getElementById('txtbox1').value,document.getElementById('txtbox2').value)" id="myCheckbox" />
<input id="checkbox2" onclick="OnChangeCheckbox (this,document.getElementById('txtbox2').value,document.getElementById('txtbox4').value)" id="myCheckbox" />
<input id="checkbox3" onclick="OnChangeCheckbox (this,document.getElementById('txtbox5').value,document.getElementById('txtbox6').value)" id="myCheckbox" />
<input type="hidden" id="total_store" name = "TotalStore" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnsubmit_onclick()" />
<pre>
private void btnsubmit_onclick(sender s,eventargs e)
{
Response.Redirect("Webform2.aspx?value=" +
Convert.Tostring(total_score.value));
}
In page2 pageload event:
private void Page_Load(object sender, System.EventArgs e)
{
this.txtBox7.Text = Request.QueryString["Value"];
}
For query string you can use encryption and decryption:
http://www.aspsnippets.com/Articles/Encrypt-and-Decrypt-QueryString-Parameter-Values-in-ASPNet-using-C-and-VBNet.aspx[
^]
Please don't exactly copy and paste the code.This is an idea that i have mentioned with which you can proceed with.If you find useful please vote for the solution and accept which will make sure that this is a solution made for your question