Click here to Skip to main content
15,741,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to insert data from textbox once submit button clicks.The data should beonly display in another page.Need to use mvc+knockoutJS.Please help I am new to mvc+knockout

What I have tried:

My view

ViewBag.Title = "Questions";
Layout = "~/Views/Shared/_Layout.cshtml";


Questions :

<input type="text" data-bind="value:Math_Q1 " />

<input type="button" class="btn btn-default" value="Next" data-bind="click:Math_Q1"/>

<script type="text/javascript" src="~/Scripts/app/Test.js"></script>"
<script src="~/Scripts/knockout-2.3.0.js"></script>

My Model class as follows;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SelfAssesmentTest.Models
public class TestResultsModels
public int Math_Q1 { get; set; }

Control Class
using System.Threading.Tasks;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SelfAssesmentTest.Models;

namespace SelfAssesmentTest.Controllers
public class SelfController : Controller
// GET: SelfAssesment
public ActionResult Index()
return View();

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