asp.net-mvc-5

Load Partial Views from Database

情到浓时终转凉″ 提交于 2019-12-08 10:28:22
问题 I'm having a requirement where the number of partial views could grow tomorrow and they could be a composition of any number of values and of any type. Well, yes, I can do this using partial views itself but the time I will add a new partial add, I will be required to recompile the application that I want to avoid. It would be very like a CMS where you just specify the fields and the form is generated on the fly based on fields and their type you specify. Edit 1 Let's say for example you're

Change route to username after registration

这一生的挚爱 提交于 2019-12-08 10:26:32
问题 I have followed the correct answer marked for this thread How to change route to username after logged in? and my requirement is exactly what the question says. However when I register a new user (I am using username instead of email) the redirection doesn't follow my custom route. For instance, when I register with username = Janet, the URL looks like localhost/?username=Janet and throws an error. But if I manually remove the "/?username=" and keep localhost/Janet then it shows the landing

losing css style in dynamically added table rows

旧巷老猫 提交于 2019-12-08 10:25:01
问题 I've read a lot about adding and removing rows from tables dynamically. I'm very sure I have done everything the right way. my view: <table id="LibList" class="table table-responsive table-condensed table-bordered"> <thead> <tr> <th> @Html.DisplayNameFor(model => model.Step3.Liabilities[0].Types) </th> <th> @Html.DisplayNameFor(model => model.Step3.Liabilities[0].Name) </th> <th> @Html.DisplayNameFor(model => model.Step3.Liabilities[0].Balance) </th> <th> @Html.DisplayNameFor(model => model

MVC5 Mqsql Issue

冷暖自知 提交于 2019-12-08 09:50:06
问题 After Update of Model from database in Entity Framework. Json Data not populate into textbox. when i use DeveloperTool i found a error "There is already an open DataReader associated with this Connection which must be closed first."[Error 505] Help me for resolve this problem.am using MySql in my project. When i use only one table in Model then i didn't get any error but when i update model then my project not working. If i add all the tables in Model then I face same problem. Here is my code

The operation cannot be completed because the DbContext has been disposed In Mqsql and Entity Framework

限于喜欢 提交于 2019-12-08 09:21:41
问题 I am doing From dropdown selection, I fill textboxes with the Json Value. Action() Method work fine It return Json value but page not populate these value to TextBoxes control. When i use Developer Tool then i get, it throw a Error "The operation cannot be completed because the DbContext has been disposed." Controller private hcEntities db = new hcEntities(); // GET: Chains public ActionResult Index() { ViewData["chain_name"] = new SelectList(db.chains, "code", "name"); return View(db.chains

How to CRUD Application Users in ASP.NET MVC 5 with Scaffolding?

北慕城南 提交于 2019-12-08 08:34:46
问题 From my experience, I can generate Controllers and Views for CRUD using EntityFrameWork(MVC 5 Controllers with Views, using EntityFramework) for Job and any other classes that are NOT derived from IdentityUser. I want to have a feature in my application where User of Role admin will be able to delete other users in the same User Table. How can I generate Controllers and Views for that using EF ? Any help would be appreciated. Thank you! public class User : IdentityUser { public string

Model with collection - Html.ListBoxFor doesn't set selected items

試著忘記壹切 提交于 2019-12-08 08:34:41
问题 This one is driving me crazy and before I loose my sane please help. Summary of the issue: My model "Thread" has collection of "ForumMessage", each ForumMessage has one Multi select drop down list. All I want to do is set the selected value based on values coming from Database. I have gone thru many threads but wasn't able to find the solution. In case if you are aware of any such question please let me know and I will go thru them. Below are my models public class Thread { public List

ASP.NET MVC 5 - IdentityUser in WCF?

Deadly 提交于 2019-12-08 08:30:12
问题 I am currently writing a WCF service that will use ASP.NET Identity to perform all membership and claims related stuff. (That is, authentication, registration, and all will be performed by calling this WCF) [DataContract(IsReference=true)] public class ApplicationUser: IdentityUser { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public string Email { get; set; } } The problem is that "IdentityUser" is a class in Microsoft

How to trap a WS-Federation callback in an OWIN MVC5 app to automatically create an identity in local database?

会有一股神秘感。 提交于 2019-12-08 08:12:55
问题 I am currently working on a vb.net MVC5 application and using WS-Federation to authenticate all the users from an ADSF 3.0 server. Everything is working fine; when the users try to access a secured controller marked with the AUTHORIZE attribute, the users are redirected to the STS login page, they login and they come back. I am able to read the CLAIMS provided by the ADFS server. My problem is that i need to create a local entry in my database when a new authenticated user comes in after

Foolproof RequiredIfTrue not working for MVC5?

你离开我真会死。 提交于 2019-12-08 07:56:24
问题 I am trying conditional required field. If user selects ContactByPhone checkbox I am showing ContactPhoneNumber field and it should be required filed. If user doesn't select ContactByPhone then ContactPhoneNumber is invisible and not required. Validation is not showing on client side. and after I submit the form ModelState.IsValid is false for this property. How to handle this? I think I referenced all scripts on the page. Do we have any alternative solution for this situation? Model public