小编Jef*_*den的帖子

在Bootstrap工具提示中显示长文本

我试图在twitter bootstrap工具提示中显示一些长文本.正如你在下面的图片中看到的那样,事情并没有发生.有没有人可以轻松修复溢出引导工具提示的文本?

工具提示溢出

编辑(添加请求的代码):

在我的控制器中:

<a href='" + Url.Action("Index", "PP", new {id = productRow.ProductGuid, area = ""}) + "' " + 
          ((blTruncated) ? "class='auto-tooltip' title='" + productRow.ProductName.Replace("'", "") : "") + "'>" + 
           productName + "</a>
Run Code Online (Sandbox Code Playgroud)

在我看来:

$('.auto-tooltip').tooltip();
Run Code Online (Sandbox Code Playgroud)

css jquery twitter-bootstrap twitter-bootstrap-tooltip

47
推荐指数
4
解决办法
9万
查看次数

当变量不为null时,为什么显示NullReferenceException?

NRE

为什么VS 2012在显示Type变量时将其显示为NullReferenceException value = "Retailer".

在此输入图像描述

我有一个新生儿,我正在努力限制睡眠,所以如果我在这里遗漏了一些明显的东西,我会道歉.已经实例化了LoggedInUser.Employer对象,并且此行在1/2时间内工作正常.但随后它开始破裂.不确定这是否有帮助 - 需要睡觉......

 private string _type;
    public string Type
    {
        get { return _type; }
        set
        {
            if (value != null)
            {
                TypeEnum = (Constants.BusinessType)Enum.Parse(typeof(Constants.BusinessType), value, true);
                _type = value;
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 我开始怀疑它是否是一个跨线程的问题......

在此输入图像描述

c# .net-4.0 nullreferenceexception visual-studio-debugging visual-studio-2012

7
推荐指数
1
解决办法
2338
查看次数

Web应用程序应在缓存中存储什么?

我意识到这可能是一个模糊的问题,而遗赠却是一个模糊的答案,但是我需要一些用于为Web应用程序缓存数据的真实示例,想法和/或最佳实践。我阅读的所有示例本质上都是技术性更高的(如何从相应的缓存存储区添加或删除缓存数据),但是我无法找到更高级的缓存策略。

例如,我的Web应用程序为每个用户提供一个收件箱/邮件功能。到目前为止,我一直在将典型的会话数据存储在缓存中。在此示例中,当用户登录时,我进入数据库并检索用户的邮件并将其存储在缓存中。我开始怀疑我是否应该一直只是在缓存中维护所有用户消息的副本,并且仅在需要时从缓存中检索它们,而不是在登录时从数据库中加载它们。我在登录时(产品目录和相关实体)还加载了一堆其他数据,并且登录开始变慢。

因此,我想向社区提出我的问题,在这种情况下,您会/建议采取什么措施?

谢谢。

optimization memcached caching web-applications azure-caching

6
推荐指数
1
解决办法
1640
查看次数

在EF CF中添加/更新导航属性

我知道这已经在SO上被多次询问了,但我找不到关于如何在EF CF中添加或更新导航属性的明确答案.

实体(简化):

 public class Basket : EntityBase
    {
        public virtual List<Fruit> TaggedFruits { get; set; }
    } 

    public class Fruit : EntityBase
        {

        }
Run Code Online (Sandbox Code Playgroud)

的ActionResult:

 [HttpPost]
        public ActionResult SaveTags(Basket basket, int[] selectedFruits)
        {
        basket.TaggedFruits = new List<Fruits>();

        foreach (int guid in selectedFruits)
            basket.TaggedFruits.Add(repository.Fruits.FirstOrDefault(p => p.Id == guid));

        using (var context = new EFDbContext())
        {
            context.Baskets.Attach(basket);
            context.SaveChanges();
        }

        return RedirectToAction("GetBasket", new {guid = basket.Guid});
    }
Run Code Online (Sandbox Code Playgroud)

我已经尝试了上面的SaveTags方法的多次迭代,但从来没有让它工作.这一个抛出:

IEntityChangeTracker的多个实例不能引用实体对象.

在研究了这里和其他站点之后,错误显然表明在方法中混合我的存储库模式和DBContext会导致冲突.

如果我使用以下方法将标记移动到存储库:

 [HttpPost]
            public ActionResult SaveTags(Basket basket, int[] selectedFruits)
            {
                   List<Fruit> taggedFruits = …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc entity-framework c#-4.0 entity-framework-4.1 asp.net-mvc-3

4
推荐指数
1
解决办法
3817
查看次数

Azure缓存System.Runtime.InteropServices.SEHException

我也跟着开始使用Windows Azure的缓存和我不断收到System.Runtime.InteropServices.SEHException:外部组件引发上线异常:

var myCache = new DataCache("default");
Run Code Online (Sandbox Code Playgroud)

我已将WindowsAzure1项目设置为启动项目.我想在调试运行时,从一个MVC API项目访问缓存,但它一直示数出来.有谁知道我可能做错了什么?谢谢.

c# azure azure-storage azure-web-roles azure-caching

3
推荐指数
1
解决办法
1333
查看次数

在jQuery UI选项卡中显示的水平子弹(仅限IE 8)

我在jQuery选项卡上的IE 8中得到了一个奇怪的子弹.显示如下图所示.如果我点击标签,子弹就会消失.有人可以帮忙吗?谢谢.

在此输入图像描述

jquery-ui jquery-ui-tabs

3
推荐指数
1
解决办法
1608
查看次数

MVC 3 Web API路由不起作用

我正在与MVC 3 Web API中的路由问题作斗争.看起来应该很简单,但我没有取得任何进展.

我的错误是:

  <Error>
     <Message>The request is invalid.</Message>
       <MessageDetail>
           The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'Boolean NewViolationsPublished(Int32)' in 'BPA.API.Controllers.CacheManagementController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
       </MessageDetail>
   </Error>
Run Code Online (Sandbox Code Playgroud)

我的RegisterRoutes是这样的:

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapHttpRoute(
              name: "NukeAllItemsFromCache",
              routeTemplate: "api/CacheManagement/NukeAllItemsFromCache");


            routes.MapHttpRoute(
                 name: "ControllerAndAction",
             routeTemplate: "api/{controller}/{action}"
             );

            routes.MapHttpRoute(
                 name: "ControllerAndActionAndId",
                 routeTemplate: "api/{controller}/{action}/{id}",
                    defaults: new { id = …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-3 asp.net-web-api asp.net-web-api-routing

1
推荐指数
1
解决办法
4038
查看次数