asp.net-mvc

Is there a correct way to add custom Javascript to an ASP.NET MVC 5 page?

我们两清 提交于 2021-02-07 12:18:49
问题 At the moment, I have added the jQuery source file to my ASP.NET project's Scripts folder. In the _Layout.cshtml page, I have included ~/Scripts/jquery-2.1.1.min.js. Right now, I can include jQuery code on every page I make this way: If this page shows a popup I was succesfull. <script> $(document).ready(function(){ alert("works!"); }); </script> However, I don't want to include a full script in every view. I would prefer to create a seperate JS file, put it in my Scripts folder, and then

Is there a correct way to add custom Javascript to an ASP.NET MVC 5 page?

陌路散爱 提交于 2021-02-07 12:16:41
问题 At the moment, I have added the jQuery source file to my ASP.NET project's Scripts folder. In the _Layout.cshtml page, I have included ~/Scripts/jquery-2.1.1.min.js. Right now, I can include jQuery code on every page I make this way: If this page shows a popup I was succesfull. <script> $(document).ready(function(){ alert("works!"); }); </script> However, I don't want to include a full script in every view. I would prefer to create a seperate JS file, put it in my Scripts folder, and then

Is there a correct way to add custom Javascript to an ASP.NET MVC 5 page?

喜夏-厌秋 提交于 2021-02-07 12:16:30
问题 At the moment, I have added the jQuery source file to my ASP.NET project's Scripts folder. In the _Layout.cshtml page, I have included ~/Scripts/jquery-2.1.1.min.js. Right now, I can include jQuery code on every page I make this way: If this page shows a popup I was succesfull. <script> $(document).ready(function(){ alert("works!"); }); </script> However, I don't want to include a full script in every view. I would prefer to create a seperate JS file, put it in my Scripts folder, and then

ASP.NET Identity without Entity Framework

浪子不回头ぞ 提交于 2021-02-07 12:14:39
问题 Is it possible to use the new ASP.NET Identity without using Entity Framework and instead use your own methods? I have an MVC project that uses plain ADO.NET for data access. I want to implement ASP.NET identity but I would like to continue to use ADO.NET and stored procedures. This is the way that I have chosen to go. 回答1: I had similar requirements to yourself and have implemented a pure SQL Server version of the ASP.NET Identity framework. I started out by creating a sample project (using

How to host ASP.NET MVC site in a subfolder

谁说胖子不能爱 提交于 2021-02-07 12:10:32
问题 I'm trying to run a little ASP.NET project in a subfolder of my hosting. My domain is www.gorangligorin.com, but i want to run my app in www.gorangligorin.com/testmvc. ASP.NET MVC runs with no problems on the top level, but not in subfolders. The server says this (line 58 is colored red): Line 56: ASP.NET to identify an incoming user. Line 57: --> Line 58: <authentication mode="Forms"> Line 59: <forms loginUrl="~/Account/LogOn" timeout="2880" /> Line 60: </authentication> What can I do to

Unsupported This version of Visual Studio is unable to open the following projects

笑着哭i 提交于 2021-02-07 11:44:08
问题 I'm getting error like this after updating sql server to 2016. I have opened the project in VS2015 & while rebuilding Database project I'm getting error like below: Unsupported This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them. For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after

Add css style sheet to app_offline

為{幸葍}努か 提交于 2021-02-07 11:43:09
问题 Well, I'm trying to make custom app_offline.htm and want to add links to my css files in project. But next code doesn't work <link href="/Content/Themes/screen.css" rel="stylesheet" type="text/css" /> In console I've got error GET mySite/Content/Themes/screen.css 503 (Service Unavailable) Please, give me advise how to make a link to css file in app_ofline.htm. Any help will greatly appriciated! 回答1: The idea of the app_offline.htm is that it indicates that the app is, well, offline. So, no

@Html.EditorFor DateTime not displaying when set a default value to it

自作多情 提交于 2021-02-07 11:42:17
问题 I'd like to set a default value to my model in Controller, But It cannot display in create page. TestModel code: public class TestModel { [DataType(DataType.DateTime), Required] [DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)] public DateTime StartTime { get; set; } [DataType(DataType.DateTime), Required] [DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)] public DateTime EndTime { get; set; } public string Description { get; set; } }

Using a Kendo Grid, how do you change the wording on the “Create” button in the toolbar?

别来无恙 提交于 2021-02-07 11:32:30
问题 I'm using a Kendo Grid I added the "create" to do an inline add of a record. How can I change the wording on the add button? Currently it reads: "Add a new Record" I want to simplify it to read just "Add" and I'd also like to keep the same Icon. My code looks like: $reports.kendoGrid( { dataSource: dataSource, toolbar: ["create"], ... Any suggestions would be greatly appreciated. 回答1: The way to do this is using the following syntax: $reports.kendoGrid( { dataSource: dataSource, toolbar: [{

A simple ASP .NET MVC API controller using roles

三世轮回 提交于 2021-02-07 11:14:44
问题 I wrote a web application using ASP .NET MVC and authorization system by default. I configured IdentityRole and input through external providers. Using the current database I have created my data context. Now I want to write a Xamarin.Android app and connect to my database, I want a simple API. But the feature that you want to access this API was only available to user with a certain role. The API is really very simple and therefore do not want to add to the draft WCF or WebAPI project. How