asp.net-mvc-3

Adding Image in html

陌路散爱 提交于 2021-02-05 11:45:30
问题 I cannot seem to add an image in html. I'm using ASP.net MVC 3. My image, named KeyLargoPic, is located on a flash drive in the folder X:\Project\Project\Photos\Key Largo, and it appears to be a JPEG. The code is as follows: <td><img src="X:\Project\Project\Photos\Key Largo\KeyLargoPic.jpg" alt="IMAGE" /></td> Every time the page loads, it shows the box with "IMAGE" inside. Does anyone know what I'm doing wrong? 回答1: Add the image to your project, probably in the content directory, by right

Adding Image in html

前提是你 提交于 2021-02-05 11:44:47
问题 I cannot seem to add an image in html. I'm using ASP.net MVC 3. My image, named KeyLargoPic, is located on a flash drive in the folder X:\Project\Project\Photos\Key Largo, and it appears to be a JPEG. The code is as follows: <td><img src="X:\Project\Project\Photos\Key Largo\KeyLargoPic.jpg" alt="IMAGE" /></td> Every time the page loads, it shows the box with "IMAGE" inside. Does anyone know what I'm doing wrong? 回答1: Add the image to your project, probably in the content directory, by right

Submit after a jquery-ajax function

旧巷老猫 提交于 2021-02-05 07:55:28
问题 I check two values with ajax. And if both are correct then i want to make a submit (post-back). But the post-back doesn't work. Here is the code: $('form').submit(function () { var correctCaptcha = false; var correctWebcode = false; $.ajax({ url: '/Competition/CheckForm', type: "POST", data: $(this).serialize(), success: function (data) { if (data == true) { $('#recaptcha_response_field').removeClass("captchaError"); correctCaptcha = true; } else { Recaptcha.reload(); $('#recaptcha_response

Using Html.RadioButtonFor with a boolean isn't writing Checked=“Checked”

落花浮王杯 提交于 2021-02-05 05:43:46
问题 I am having an issue using the RadioButtonFor helper. When the value passed in is true, it isn't displaying a "check" in either radio button. When the value is false, it works just fine. I copied this code from the project I am working on and created a sample application and I was able to replicate the issue. If I hard coded the value to true or false it seems to work, but when I use the "!string.IsNullOrEmpty(allgroups)" it doesn't. From the View: <div> @Html.RadioButtonFor(m => m.AllGroups,

TempData not carrying over during RedirectToAction

落爺英雄遲暮 提交于 2021-02-04 17:22:16
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

TempData not carrying over during RedirectToAction

孤人 提交于 2021-02-04 17:21:37
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

TempData not carrying over during RedirectToAction

烈酒焚心 提交于 2021-02-04 17:21:10
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

Generate Full URL ASP.NET MVC Razor Views

血红的双手。 提交于 2021-02-04 16:50:34
问题 I am trying to generate the full URL for a route link in my razor view for ASP.NET MVC 3. I know I can use Html.RouteLink to generate a link however all I want is the URL, not the surrounding a tag wrapper. Is there a way to do this? 回答1: Use the UrlHelper. Url.RouteUrl( "MyRoute" ) 回答2: Are you talking about: <a href="@Url.Action("Action", "Controller", new { @id = "2" })"> Link to Page</a> vs. @Html.ActionLink("Link to page", "Action", "Controller", new { @id = "2" }) The Url Model builds

How can I make one to one chat system in Asp.Net.Core Mvc Signalr?

≡放荡痞女 提交于 2021-01-29 19:28:00
问题 I want to implement private chat system with Mssql Database. This codes works as public when I send the message, message is appears all clients. But I want to one to one chat system. One user enter the receiver id which stored in database and message text, then send the message to Receiver . Then the message appears in receiver message area which has that receiver id. Here is my js code "use strict"; var connection = new signalR.HubConnectionBuilder().withUrl("/chathub").build(); //Disable

Razor Partial View Error

为君一笑 提交于 2021-01-29 07:04:02
问题 I'm following the example website being built in Pro ASP.NET MVC 2 Framework (but using Razor instead of ASPX as I go along). However, I've hit a snag with a partial view. I'm getting the following error: The model item passed into the dictionary is of type 'SportsStore.WebUI.Models.ProductsListViewModel', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[SportsStore.WebUI.Models.NavLink]'. Here are the relevant files: _Layout.cshtml: <!DOCTYPE html>