public IList<Labour> Labours { get; set; } public class Labour { public string WorkDates { get; set; } public string WorkHour { get; set; } } I have this code above on my class. How can i add this to my Create View Razor? can anyone tell me please. Also how i can add another Labour in running time.

Member Avatar
Member Avatar
+0 forum 13

Hi there, in am new with Webmatrix and Visual studio 2013 and i would like to create the following : (for all user of the website) 1) a classic form contact in asp.net razor : email name subject message If is possible this message wil send an aoutomatic mail to my mail address (for admin, me...) 2) List of contact but not with gridview, we click on one contact and we open the contact 3) Page of the single contact where we can edit or delete it 4) Page of edit Have you got some code already done to send …

Member Avatar
Member Avatar
+0 forum 6

When I click the login button I never get any values posted to the server. I accept a AuthViewModel but it is always null. I have tried using @html.EditorFor but have not had any luck with it. **User Controller** [HttpGet] public ActionResult Password() { UserModel user = (UserModel)Session[Constants.SessionVars.Authenticate]; //error - need a profile if (user == null) return Redirect("/User/Login"); return View(new AuthViewModel()); } [HttpPost] public ActionResult Password(AuthViewModel password) { UserModel user = (UserModel)Session[Constants.SessionVars.Authenticate]; //error - need a profile if (user == null) return Redirect("/User/Login"); if (password == null || string.IsNullOrEmpty(password.Password)) { ViewBag.Error = Constants.ErrorMessages.UserPassword_PassBlank; return View(new AuthViewModel()); } var dataContext …

Member Avatar
Member Avatar
+0 forum 6

Can anyone help me. My code is not working this is cascading drop down list. It's connected to my database. Jquery Code: <script type="text/javascript"> $(document).ready(function () { $("#SiteId").change(function () { var idDept = $(this).val(); $.getJSON("Service/GetBuildingNameList", { id: idDept }, function (myData) { var select = $("#BuildingID"); select.empty(); $.each(myData, function (index, itemData) { select.append($('<option/>', { value: itemData.Value, text: itemData.Text })); }); }); }); }); </script> @Html.DropDownListFor(model => model.SiteId, new SelectList(ViewBag.ListSiteClass as System.Collections.IEnumerable, "SiteId", "SiteName"), "", new { id = "SiteId" }) @Html.DropDownListFor(model => model.BuildingId, new SelectList(Enumerable.Empty<SelectListItem>(), "BuildingID", "BuildingName"), "", new { id = "BuildingID" }) Controller Code: [AcceptVerbs(HttpVerbs.Get)] public JsonResult GetBuildingNameList(int …

Member Avatar
Member Avatar
+0 forum 3

Hi, I am confused between razor and asp.net coding. Asp.net code itself is a server side code so why it is said that razor code is server side embedding code for creating dynamic web pages? Normal asp.net code also runs at server side so what is the need for razor than?

Member Avatar
Member Avatar
+0 forum 1

Hello, I'm currently following the video tutorials found on asp.net (the site)\ And I just finished my delete page but I'm getting errors. This is the code of the page DeleteMovie.cshtml [CODE]@{ Layout = "~/_SiteLayout.cshtml"; var id = Request["MovieID"]; var SQLSELECT = "SELECT * FROM Names where MovieID=@0"; var db = Database.Open("Movies"); var Movie = db.QuerySingle(SQLSELECT, id); var MovieName = Movie.MovieName; if(IsPost) { var SQLDELETE = "DELETE FROM Names WHERE ID=@0"; db.Execute(SQLDELETE, id); Response.Redirect("Default.cshtml"); } } <h1>Delete Movie</h1> <p>Are you sure you want to delete <b>@Movie.MovieName</b>? <form action="" method="post"> <input type="submit" value="Yes" /> <input type="button" value="No" onclick="window.location = 'Default.cshtml'" /> …

Member Avatar
+0 forum 0

i need to have Total of price displayed in webgrid. from the code below. [CODE] @{ var db = Database.Open("SmallBakery") ; var selectQueryString = "SELECT * FROM Product ORDER BY Id"; var data = db.Query(selectQueryString); var grid = new WebGrid(source: data, defaultSort: "Name", rowPerPage: 3); } <!DOCTYPE html> <html> <head> <title>Displaying Data Using the WebGrid Helper (Custom Formatting)</title> <style type="text/css"> .product { width: 200px; font-weight:bold;} </style> </head> <body> <h1>Small Bakery Products</h1> <div id="grid"> @grid.GetHtml( columns: grid.Columns( grid.Column("Name", "Product", style: "product"), grid.Column("Description", format:@<i>@item.Description</i>), grid.Column("Price", format:@<text>$@item.Price</text>) ) ) </div> </body> </html> [/CODE]

Member Avatar
Member Avatar
+0 forum 1

Dear readers and administrators, I wonder if I have the right to suggest here to add new item list in this site but it since I have the right post it here, I want to suggest to add a forum section or thread section under web development about the new web programming language called CSHTML (C# HTML or what is called easily to remember as RAZOR Programming Web Development) Just simply call it as RAZOR. When I found this out... I found it interesting than ASP.NET MVC so easier than JavaScript alone and can embed C# files or codes into …

Member Avatar
Member Avatar
+0 forum 2

This past Summer, Microsoft announced the beta of a new product called WebMatrix. Two weeks ago, the third beta came out. But before I talk about it, I have to ask: Is this a new product? Or am I having déjà vu?[ATTACH]18093[/ATTACH]WebMatrix (one word) is, in fact, a brand new product from Microsoft (contrary to what some tech journalists have reported), even though the name has been recycled from an earlier web development tool called Web Matrix (two words) that many of us remember dating back to the around 2003. That earlier product has very little in common with this …

Member Avatar
Member Avatar
+3 forum 1

The End.