1
Answer

ASP.net --? how can i pase the value "waarde"

Photo of Cassie Mod

Cassie Mod

9y
341
1
HI,
 
How can i pass a value of a controller, to the HTML file ?
 
model:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace TelerikMvcApp1.Models
{
public class ProgramStatus
{
[Key]
public string ProgramName { get; set; }
public DateTime ProgramLastRun { get; set; }
}
public class ProgramStatusContext : DbContext
{
public DbSet<ProgramStatus> Stats { get; set; }
}
}
 
controller:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using TelerikMvcApp1.Models;
namespace TelerikMvcApp1.Controllers
{
public class ProgramStatusController : Controller
{
private ProgramStatusContext db = new ProgramStatusContext();
// GET: ProgramStatus
public ActionResult Index()
{
var waarde = db.Stats.First().ProgramLastRun;
return View();
}
}
 
i need to pase the value "waarde" to the HTML file so i can use it as value for the calender
 
 
HTML:
@model TelerikMvcApp1.Models.ProgramStatus
@{
ViewBag.Title = "Index";
}
<div id="background">
@(Html.Kendo().Calendar()
.Name("Calender")
.Value(Model.ProgramLastRun) ?? gives error... is not based on an object
   )
</div>
<style>
#background {
width: 254px;
height: 250px;
margin: 30px auto;
padding: 69px 0 0 11px;
background: url('@Url.Content("~/content/web/calendar/calendar.png")') transparent no-repeat 0 0;
}
#calendar {
width: 241px;
}
</style>
 

Answers (1)

2
Photo of Ronika Jency
NA 270 3k 7y
Your tbl_target table missing the column name of year. If you include that column name then you can filter the data 501 employee id may month of 2017. or else you will have two 501 record with same month.
 
Another option also you can add one more column Created_Date in that you can get year.
2
Photo of Khaja Moizuddin
NA 6.3k 206.6k 7y
You need to join both the tables and get/track the employee records