Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create an attendance sheet in MVC4 which could update the daily attendance into database. Since i am new to IT i have no clue how to start that. PLease help
Posted
Comments
Harikrishna G 24-Apr-15 3:19am    
do u have doubts on creating form for Attendance?
Member 11579819 24-Apr-15 3:41am    
actually i created an incomplete form like i managed to display the no. of days under every individual but have no idea how to enter the attendance and how to save those to database.. i would really appreciate your help if you can help me to start from the scratch or any sort of help which you can offer me. hope to hear from you soon
F-ES Sitecore 24-Apr-15 4:23am    
A forum like this isn't the best place to learn something from scratch. Go through some "getting started with mvc" tutorials (some are on asp.net) and they will take you through the basics of doing a site from scratch, even forms and database access. Google "nerd dinner" or "mvc music store"

1 solution

in html,

EmployeeName : <input id="txtFname" type="text" />
EmployeeId : &amp;lt;input id="txtempid" type="text" /&amp;gt;
Date : <input id="txtDate" type="text" />

you can add this as your requirement


in Jquery,

get the values by using following syntax

var empname=$('#txtFname').val();
var empid=$('#txtempid').val();
var date=$('#txtDate').val();

$.ajax({

url: 'ControllerName/methodName?empid=' + empid+ '&empname=' + empname+ '&date=' + date,
type: 'POST',

contentType: "application/json; charset=utf-8",
dataType: "json",
async: "true",
cache: false,
success: function (result) {
if (result > 0) {
location.reload();
}
},
Error: function (x, e) {
alert('failure');
}
});


In controller

public ActionResult SaveData(empid,empname,date)
{
int result=0;

//code to save the data in database

return Json(result, JsonRequestBehavior.AllowGet);
}



Mark it as 'Answer' if you solve your problem.
 
Share this answer
 
Comments
Member 11579819 24-Apr-15 5:12am    
Thanks much for the help
Harikrishna G 24-Apr-15 5:40am    
you are welcome
Member 11579819 24-Apr-15 5:47am    
it would be nice if you could suggest me any link or tutorial on AJAX and JQuerry
Harikrishna G 24-Apr-15 5:55am    
http://api.jquery.com/
Member 11579819 24-Apr-15 7:30am    
thank you...appreciate your help

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