asp.net-webpages

Razor Pages On Server Validation returning for without some fields

落花浮王杯 提交于 2019-12-13 02:36:55
问题 I'm having an issue with a server side validation with Razor Pages (ASP.Net Core 2.0) I have a page that creates a record http://localhost:56876/Entries/Create?employeeID=112345 my code behind file for the OnGet looks like: [BindProperty] public EntryLog EntryLog { get; set; } public Employee Employee{ get; set; } public string empID { get; set; } public IActionResult OnGet(string employeeID) { empID = employeeID; // for Selects for lookup tables ViewData["ReasonId"] = new SelectList(_context

Conflicting versions of ASP.NET Web Pages detected: specified version is “1.0.0.0”, but the version in bin is “2.0.0.0” in ASP.MET MVC 3

夙愿已清 提交于 2019-12-12 07:39:23
问题 I am getting the following error after installing microsoft web helper: Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0". To continue, remove files from the application's bin directory or remove the version specification in web.config. From what I read, I might have tried instaling the wrong version. But how do i orrect this? So far, I have uninstall the microsoft web helper Deleted and content of the bin folder and

_PageStart.cshtml vs _ViewStart.cshtml in ASP.NET

别说谁变了你拦得住时间么 提交于 2019-12-12 03:25:08
问题 I found there's _PageStart.cshtml in http://www.asp.net/web-pages/overview/ui-layouts-and-themes/18-customizing-site-wide-behavior and _ViewStart.cshtml in http://weblogs.asp.net/scottgu/asp-net-mvc-3-layouts. So what is the difference between _PageStart.cshtml and _ViewStart.cshtml? 回答1: They both perform the same function but _ViewStart is MVC-only. You can use _PageStart in either framework. 来源: https://stackoverflow.com/questions/36519541/pagestart-cshtml-vs-viewstart-cshtml-in-asp-net

Getting error 0004: Could not load System.Data.SqlServerCe.Entity.dll. Reinstall SQL Server Compact

老子叫甜甜 提交于 2019-12-11 23:21:32
问题 I am working on a ASP.NET Web Pages site with SQL Server CE 4.0. I believe my SQL Server CE 4.0 database is working fine. I can connect to it without any problems on my dev machine with and without Entity Framework. Once I push the site to the server, I can connect to it fine without entity framework using this connection string: <add name="StarterSite" connectionString="Data Source=|DataDirectory|\StarterSite.sdf" providerName="System.Data.SqlServerCe.4.0" /> My Entity Framework connection

Why call ASP.NET WebAPI package libraries with version 5.1.0 as ASP.NET WebAPI 2.1?

笑着哭i 提交于 2019-12-11 14:53:25
问题 I want to get started with ASP.NET MVC and WebAPI that was released in Jan 2014. ASP.NET MVC 5.1, ASP.NET Web API 2.1 and ASP.NET Web Pages 3.1 (Ref: NuGet) I created a new ASP.NET Web application (.NET 4.5.1) > "Empty template" > "Web API" checked > "No Authentication" Under the NuGet packages folder I checked the version of libraries referenced by this Web API empty project and found that all DLL (except NewtonSoft) is having a version similar to 5.1.. This is also true for ASP.NET MVC

Url Routing ASP.NET WebPages (.cshtml) without MVC

僤鯓⒐⒋嵵緔 提交于 2019-12-11 09:04:34
问题 How can I route an url to a .cshtml page? E.g. www.example.com/view/2 --> view.cshtml I don't want to use MVC and preferably not complicate things with controller code and other stuff. Just a routing as simple as possible. 回答1: Simple routes like the one where you just want to reach an existing file name without the extension work by default in a Web Pages site. The 2 is accessible in the UrlData collection. Here's an article that explains how the rudimentary routing system works in Web Pages

Why is SQL CE Toolbox failing to parse my csv file?

匆匆过客 提交于 2019-12-11 07:18:55
问题 SQLCEToolbox looks very promising. I installed it, opened VS 2012, selected Tools | SQL Server Compact Toolbox, quickly and easily set up a connection to my sdf database, which I had (also quickly and easily) created in WebMatrix. I then right-clicked the database in SQLCEToolbox's treeview and selected Import from CSV file. Note: One must explicitly specify the column names on the first line in the file (line/row 0) and explicitly add the ID/Primary Key/Identity vals (if you have such a

Running aspnet web site starts on parent directory

廉价感情. 提交于 2019-12-11 06:37:20
问题 I have some old project written in asp.net web pages. I open project by Open Website option and choosing MyCompany folder. I start a project with debugging. The Asp.NET Development server starts. Actual: localhost:53669/MyCompany/somepage.aspx Expected: localhost:53669/somepage.aspx How can I force the ASP.NET development server to start on MyCompany folder location not on the parent folder location? 回答1: What version of Visual Studio are you using? In Visual Studio 2010, you can change it in

How can I make a custom error page in ASP.NET web-pages with WebMatrix?

不羁的心 提交于 2019-12-10 14:04:57
问题 Believe it or not I tried to look for the answer to this question with a simple Google Search but I didn't find anything (Googled with "WebMatrix custom error page", "WebMatrix how to make custom server-side error page", etc.), but perhaps I am not searching with the correct terms... Anyway, I was just wondering if there was a way (I believe it involves the web.config file) to show a custom-made error page instead of ANY server-side error page. I know there is a way to do this with some pages

Why does my img error function fail?

旧巷老猫 提交于 2019-12-10 04:15:07
问题 Some of the img elements that I am dynamically building may (do) fail. For those cases, I have some code I got from here:Is there a way to programmatically determine that an image link is bad? namely this: function getNatlBookCritics() { var htmlBuilder = ''; // Doesn't do diddly-squat - wrong spot for it? $('img').error(function () { $(this).attr("src", "Content/NoImageAvailable.png"); }); $.getJSON('Content/NBCCJr.json', function (data) { $.each(data, function (i, dataPoint) { . . . ...but