asp.net-mvc-5

Unique key applying on asp.net MVC 5 model property

心已入冬 提交于 2020-01-03 02:23:33
问题 I have User(name,password) model and Roles model(id,role).Now what I want is mapping model(id,Uid,Rid) between these two models and here Uid,Rid foreign keys also Uid should be unique. How can acheive this. I have done with foreign key and with mapping table but I stuck at unique key applying on Uid. Can anyone help me in this? Thanks in advance. public class Image { public int id { get; set; } public string Name{ get; set; } public String Password { get; set; } } //User roles class public

ASP.NET MVC: Check database connectivity on application startup

江枫思渺然 提交于 2020-01-02 18:52:09
问题 1- Sometimes my SQL Server is down for maintenance, so when I try to run my ASP.NET MVC application i face the yellow error screen with error network-related or instance-specific error occurred while establishing a connection to SQL Server. Since I don't know the sequence of events in ASP.NET MVC I want to know where I should check connectivity so can I redirect user to a view informing him/her about this situation (instead of displaying this error page). I saw this answer in asp.net forum

ASP.NET MVC 5 Editor for 2-dimensional array

删除回忆录丶 提交于 2020-01-02 14:56:53
问题 I have a model with two-dimensional array in it: public class Matrix { public ValidInt[][] Data; [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Width { get; set; } [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Height { get; set; } public Matrix(int w, int h) { Width = w; Height = h; Data = new ValidInt[w][]; for (int i = 0; i < w; i++) this.Data[i] = new ValidInt[h]; } public class ValidInt { [Range(0, 8, ErrorMessage = "Введите число, соответствующее

ASP.NET MVC 5 Editor for 2-dimensional array

瘦欲@ 提交于 2020-01-02 14:56:23
问题 I have a model with two-dimensional array in it: public class Matrix { public ValidInt[][] Data; [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Width { get; set; } [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Height { get; set; } public Matrix(int w, int h) { Width = w; Height = h; Data = new ValidInt[w][]; for (int i = 0; i < w; i++) this.Data[i] = new ValidInt[h]; } public class ValidInt { [Range(0, 8, ErrorMessage = "Введите число, соответствующее

ASP.NET MVC 5 Editor for 2-dimensional array

江枫思渺然 提交于 2020-01-02 14:55:10
问题 I have a model with two-dimensional array in it: public class Matrix { public ValidInt[][] Data; [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Width { get; set; } [Range(0, 8, ErrorMessage = "Введите ширину картины")] public int Height { get; set; } public Matrix(int w, int h) { Width = w; Height = h; Data = new ValidInt[w][]; for (int i = 0; i < w; i++) this.Data[i] = new ValidInt[h]; } public class ValidInt { [Range(0, 8, ErrorMessage = "Введите число, соответствующее

ASP.NET MVC 5 Wrong Redirect Login Page

陌路散爱 提交于 2020-01-02 13:26:42
问题 I'm creating ASP.NET MVC 5 with "Individual User Accounts" Authentication Template. Then I create custom login page to authenticate user from database with Forms Authentication. <authentication mode="Forms"> <forms loginUrl="~/User/SignIn" timeout="2880" protection="All" /> </authentication> For testing the custom login page, I add HomeController with Authorize attribute. After run the visual studio, it redirect to the SignIn page The problem is when I remove Authorize attribute at

Download multiple files selected with MVC5

六眼飞鱼酱① 提交于 2020-01-02 09:56:11
问题 I am developing a view in MVC5 that looks like this: I need to select one or more records of the table and to be able to download the previously saved files, in the database. I have been looking for a solution and done several tests, but I can not find a solution. I was trying to send from javascript the selected codes to the controller and download the documents from the same, but I could not do it. The download could be in case you can, taking all the files and generating a zip, or

28 seconds difference in DateTime column after exporting from Kendo Grid to Excel

拟墨画扇 提交于 2020-01-02 08:11:50
问题 We have a few grids in our web application and we use Kendo for ASP.Net MVC. Some clients are reporting that dates are different when they export the grid data to Excel. As an example, the first row comes from the controller as { "SaleDate": "2018-05-30T00:00:00", "SaleDateAndTime": "2018-05-30T08:01:40.673" } . After exporting to excel, the corresponding cell values are: 05/29/2018 23:59:32 and 05/30/2018 08:01:12 , respectively. I tried exporting dates with different time values and the

28 seconds difference in DateTime column after exporting from Kendo Grid to Excel

倖福魔咒の 提交于 2020-01-02 08:11:42
问题 We have a few grids in our web application and we use Kendo for ASP.Net MVC. Some clients are reporting that dates are different when they export the grid data to Excel. As an example, the first row comes from the controller as { "SaleDate": "2018-05-30T00:00:00", "SaleDateAndTime": "2018-05-30T08:01:40.673" } . After exporting to excel, the corresponding cell values are: 05/29/2018 23:59:32 and 05/30/2018 08:01:12 , respectively. I tried exporting dates with different time values and the

Asp.net MVC 5 redirect to Account/Login

非 Y 不嫁゛ 提交于 2020-01-02 07:25:25
问题 I'm learning ASP.NET MVC. I have MVC version 5.2.2.0 I attached Authorize attribute to an action method Index() in Employee controller. In the Web.config file, I changed authentication tag data as follows: <system.web> <authentication mode="Forms"> <forms loginurl="~/Authentication/Login"></forms> </authentication> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> What is expected is that when localhost:port/Employee/Index is accessed, the