Hello Friends,
please help me i am new in MVC Dot net, and i am try to insert label value on database i have a two labels first for IP address and Second for Current running time and three submit buttons checkin, checkout and going for personal task.
on page load checkout and personal task buttons are hidden, only show 2 labels and check in button.
when i am clicking on checkin button both labels value stored in database ms sql2008 . and automatically checkout and personal task button should be enabled and check in button should be disabled.
when i am doing this task with jquery or java script on click event then my insertion task on controller not working only jquery worked.
please help me how i can calling client side click event with html submit button..
my code is: on view -->
<button id="btnchkin" value="CheckIn" type="submit" name="action"/>
<input type="submit" id="btntask" name="action" value="PersonalTask" />
<input type="submit" id="btnchkout" name="action" value="CheckOut" />
on script tag -->
$("#btnchkin").click(function () {
alert("a");
// $('#btnchkin').prop('disabled', true);
$('#btntask').prop('disabled', false);
$('#btnchkout').prop('disabled', false);
$('#btnchkin').prop('disabled', true);
//alert("b");
});
and controller-->
[HttpPost]
[ActionName("Index")]
public ActionResult Index( string lblIP1)
{
DateTime datetime = DateTime.Now;
string date = datetime.ToString();
date = datetime.Date.ToString();
lblIP1 = ipp;
string ip = lblIP1;
string s = DateTime.Now.ToString("hh:mm:ss tt");
EmployeeSchedule emp = new EmployeeSchedule();
emp.IP = ip;
emp.CurrentDate = Convert.ToDateTime(date);
emp.CheckInTime = s.ToString();
BAL_EmployeeSchedule employeeBusinessLayers = new BAL_EmployeeSchedule();
employeeBusinessLayers.AddEmployee(emp);
ViewBag.ip = ipp;
return View();
}