razor

Show a tooltip with more info when mousover a MVC3 Razor WebGrid row

时光总嘲笑我的痴心妄想 提交于 2019-12-24 08:39:35
问题 I have a grid with a list of persons. On mouseover a certain persons row I would like to show additional info (photo, address etc) in a tooltip. All the needed data exist in the model, but I don't know how to add the tooltip functionality inside the grid. I also wonder if the jquery ui tooltip is a good choice for this? TIA :) 回答1: Here is the code sample to show tool-tip in asp.net mvc webgrid : grid.Column("LongTextColumn", "Column Header Here" , format: (item) => Html.Raw("<abbr style=

Actionlink with no routeValues being loaded with routeValue breaking dynamic pages

南笙酒味 提交于 2019-12-24 08:34:50
问题 When you have an actionlink that is written with no routeValues and you load that page with a routeValue specified MVC writes out the actionlink incorrectly. I have had exactly the same bug with MVC attribute routing as well where you specify a url something like this: [Route("reviews/{reviewId}")] I have escpecially had problems with this where it breaks dynamic content pages that are loaded by a routeValue and when you have multiple actionlinks that point to the dynamic action result on the

Select All checkbox on EditorFor MVC C# View

瘦欲@ 提交于 2019-12-24 08:31:23
问题 My current view is displaying a list of Employees. All rows and columns displayed are model bound. See my view code below: @using System.Linq @using DN_.Extensions @model DN_.Models.NotificationsModel <script src="~/Scripts/jquery-3.3.1.min.js"></script> <script type="text/javascript" language="javascript"> $(function () { $("#checkAll").click(function () { $("input[id='cb_Notify']").prop("checked", this.checked).change(); var count = $("input[name='cb_Notify']:checked").length; }) $("input

Conditionally display an image in webgrid

て烟熏妆下的殇ゞ 提交于 2019-12-24 08:18:48
问题 nemesv's code Conditionally display an image in webgrid - mvc 3 works great in MVC3. @grid.GetHtml( displayHeader: false, columns: grid.Columns( grid.Column(format: (item) => { if (item.IsMainPreview == true) { return Html.Raw(string.Format("<text><img src=\"{0}\" alt=\"Image\"/></text>", Url.Content("~/Content/images/preview-photo.gif"))); } In MVC4 you don't need Url.Content to use the "~". I haven't been succesful in getting the code to work without the Url.Content (it can't find the image

Orchard - Wrappers for Fields

房东的猫 提交于 2019-12-24 08:18:21
问题 I'm trying to use a wrapper view for fields in a custom form but when I do the wrapper content shows up fine but I lose my field. I've looked over this tutorial on placement and I'm trying to use the wrapper functionality to get separators into my custom form to break up the questions but it's not working. For example I've got a question on my form that asks for Name. in my placement file I have the following <!-- content:2.[section].[questionNumber] --> <Place Fields_Common_Text_Edit-Name=

Strange Behavior in Razor MVC while using Html.Helpers

我是研究僧i 提交于 2019-12-24 07:38:57
问题 I am using Razor HtmlHelpers. using the code below i tried to print the value of ViewItemDto but it always show 0 for using @Html.TextBoxFor or any @Html...For(x=>..) method. Does anybody have a idea why this is happening? Note - The method is returning proper value as i can debug and see the value in debug window on views side. [DataContract] [Serializable] public class ViewItemDto { [DataMember] public decimal ViewItemId { get; set; } [DataMember] public string ItemName { get; set; } } From

ASP.NET Core Url.Action return empty string

本秂侑毒 提交于 2019-12-24 07:38:38
问题 After 3 hours browsing on stackoverflow I don't find solution of my problem. So I suspect something in my project is special. I have a ASP.NET Core (2.0) WebApplications Project on Visual Studios 2017. I try to make a ajax call from my Kalender.cshtml file: return $.ajax({ type: 'GET', url: myurl, data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { //REQUEST SUCCESS alert(result); }, with myurl: var myurl = '@Url.Action("EventsRead",

How reliant should I be on Session

落爺英雄遲暮 提交于 2019-12-24 07:17:11
问题 I am using session to do two things: Keep track of which css file to load for a particular company. Keep track of the Company Id Guid that tracks what company we are in. I am seeing that this is coming in as null sometimes but I'm not getting a consistent problem to track down. I have no doubt this is probably something in my code that I need to track down but this bring me up to my questions about session... Am I relying on Session to much to pass information between screens? Is it

Get scaffolder to generate fields in specific order

落爺英雄遲暮 提交于 2019-12-24 07:09:18
问题 I am trying to get asp.net core MVC to scaffold a Razor View with fields in a different order than the apparently default alphabetical order. I've got a simple model: public class Application : EntityBase { [Display(Name = "Naam", Order = 1)] public string Name { get; set; } [Display(Name = "Omschrijving", Order = 2)] public string Description { get; set; } } I want the scaffolder to generate a field for Name before Description. How to do this? I've been trying to come up with a solution in

Rendering partial view dynamically in ASP.Net MVC3 Razor using Ajax call to Action

杀马特。学长 韩版系。学妹 提交于 2019-12-24 07:06:35
问题 I'm trying to create a single page form to create a 'work item'. One of the properties is a drop down for 'work item type'. Depending on the work item type, the user may need to provide additional information in a name-value-pair style attributes grid (property sheet). I would like to dynamically render the property sheet as soon as a work item type is selected or changed. Once the user provides all information, he would click submit to create the 'work item'. This is what I have so far: