小编Cri*_*riu的帖子

页面在Google Chrome中加载两次

有没有人在PageLoad在Google Chrome中执行两次有任何问题?这是一个简短的问题,我不知道还有什么可以解释......

我有一个简单的asp.net页面,在Firefox和IE中它都运行良好.但在Chrome中,Page_Load被解雇了两次......

任何人都有任何想法?

后来编辑: - 奇怪的是,我有4个中继器...与随机值绑定.随机方法被两次触发(因为页面加载了两次)但是转发器采用INITIALLY值...因此,在渲染步骤之后以某种方式提升了第二个帖子.

第3次编辑:它只在刷新时发生!

解决方案(在我的情况下):有一个空的img src,这就是原因

asp.net google-chrome

31
推荐指数
5
解决办法
3万
查看次数

奇怪的MVC问题

我遇到以下代码时遇到问题:

@Html.RenderPartial("_SortDisplayPage", new ViewDataDictionary { { "bottomClass", "pagingBottom" } })
Run Code Online (Sandbox Code Playgroud)

它给出了错误:

Cannot implicitly convert type void to object
Run Code Online (Sandbox Code Playgroud)

我觉得它很小但却找不到......

asp.net-mvc

12
推荐指数
2
解决办法
6735
查看次数

如何在node.js(express)中全局设置内容类型

我可能错了,但我无法在任何文档中找到它.我正在尝试为任何响应设置全局内容类型并执行以下操作:

    // Set content type GLOBALLY for any response.
  app.use(function (req, res, next) {
    res.contentType('application/json');
    next();
  });
Run Code Online (Sandbox Code Playgroud)

在定义我的路线之前.

 // Users REST methods.
  app.post('/api/v1/login', auth.willAuthenticateLocal, users.login);
  app.get('/api/v1/logout', auth.isAuthenticated, users.logout);
  app.get('/api/v1/users/:username', auth.isAuthenticated, users.get);
Run Code Online (Sandbox Code Playgroud)

出于某种原因,这不起作用.你知道我做错了什么吗?在每个方法中单独设置它,但是我想要全局...

javascript content-type node.js express

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

sql搜索包含变音符号的字段

我正在使用Sql server 2008 express版的网站搜索.

我有'Books'表,其中有一个名为'Title ' 的字段,其中有标题包含罗马尼亚语(拉丁语)字符.

好吧,如果用户在搜索字段中插入一个单词:'casa',我在db中有一个标题,如:' testcasătest ',我想显示那本书但是:

select * from books where title like '%casa%'
Run Code Online (Sandbox Code Playgroud)

找不到它......

你知道在做选择时删除变音符号的任何函数吗?

我知道我可以用sql server的全文搜索附加组件解决问题,但我想以更简单的方式做到这一点.

sql collation sql-server-2008

11
推荐指数
2
解决办法
4293
查看次数

DNN与复合C1 - Pro和Cons

我花了几个小时就已经为我的一个客户的新业务研究了一些CMS解决方案......最后,我考虑了这两个:DotNetNukeComposite C1.

我知道所有这些都有很多功能,很多功能等.

我想知道的是:

  • 任何与这两个人合作过的 .NET家伙都在哪儿?(如果是的话,请你分享你的意见 - PRO和CONS?)

  • 如果由于某种原因我需要添加一些新的ASP.NET代码(对于一些自定义的东西),这两个中哪一个更好?

asp.net content-management-system c1-cms

11
推荐指数
3
解决办法
4716
查看次数

与PostgreSQL一起使用时的光滑问题

我使用的是光滑的斯卡拉项目来查询一些表.

    //define table
object Addresses extends Table[Address]("assetxs.address") {
  def id = column[Int]("id", O.PrimaryKey)
  def street = column[String]("street")
  def number = column[String]("number")
  def zipcode = column[String]("zipcode")
  def country = column[String]("country")
  def * = id ~ street ~ number ~ zipcode ~ country <> (Address, Address.unapply _)
}
Run Code Online (Sandbox Code Playgroud)

如果我使用这个表的任何查询它不起作用(它说它找不到我的表)所以我更进一步打印出查询,如:

implicit val session = Database.forURL("jdbc:postgresql://localhost:5432/postgres", driver = "org.postgresql.Driver", user="postgres", password="postgres").createSession()
      session.withTransaction{
        val query = Query(Addresses)
        println("Addresses: " + query.selectStatement)
}
Run Code Online (Sandbox Code Playgroud)

我注意到schema.table的名称出现在,""所以语句是:

select x2."id", x2."street", x2."number", x2."zipcode", x2."country"
from "assetxs.address" …
Run Code Online (Sandbox Code Playgroud)

postgresql scala slick

11
推荐指数
2
解决办法
5398
查看次数

已删除的实体已传递给持久异常

我有这种实体:

文件| n ..到.1 | DocumentType | 1 ..到.. n | PropertyType | 1 ..到.. n | DocumentProperty

我只是尝试删除一个文件,如:entityManager.remove(document);

但错误是触发:

16:45:51,499 ERROR [[Seam Resource Servlet]] servlet的Servlet.service()Seam资源Servlet抛出异常javax.persistence.EntityNotFoundException:传递给persist的已删除实体:[up.docstore.PropertyType#]

问题似乎来自这里:

@OneToMany(mappedBy = "documentType", cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
@ForeignKey(name = "FK_DOCUMENT_TYPE__PROPERTY_TYPE")
@Sort(type = SortType.NATURAL)
private SortedSet<PropertyType> propertyTypes = new TreeSet<PropertyType>();
Run Code Online (Sandbox Code Playgroud)

如果我删除CascadeType.PERSIST所有它的工作.但我需要它,我也需要它.

有谁知道其他解决方案?

编辑:删除DELETE_ORPHAN级联,但仍然是同样的问题.

java hibernate jpa

10
推荐指数
2
解决办法
3万
查看次数

返回asp.net mvc中的当前URL

我有一个方法:

public ActionResult AddProductToCart(int productId)
    {
        var product = _productService.GetProductById(productId);
        if (product == null)
            return RedirectToAction("Index", "Home");

        int productVariantId = 0;
        if (_shoppingCartService.DirectAddToCartAllowed(productId, out productVariantId))
        {
            var productVariant = _productService.GetProductVariantById(productVariantId);
            var addToCartWarnings = _shoppingCartService.AddToCart(_workContext.CurrentCustomer,
                productVariant, ShoppingCartType.ShoppingCart,
                string.Empty, decimal.Zero, 1, true);
            if (addToCartWarnings.Count == 0)
                //return RedirectToRoute("ShoppingCart");
            else
                return RedirectToRoute("Product", new { productId = product.Id, SeName = product.GetSeName() });
        }
        else
            return RedirectToRoute("Product", new { productId = product.Id, SeName = product.GetSeName() });
    }
Run Code Online (Sandbox Code Playgroud)

你看到被注释掉的行:我希望那里不会触发任何重定向,而只是停留在发出此请求的同一页面上.

如果我return View()说它不好,因为它将搜索具有此名称的View,而此方法是添加到购物车的简单操作..

你能给我一个如何重定向到当前网址或保持在同一页面的解决方案吗?

razor asp.net-mvc-3

10
推荐指数
2
解决办法
2万
查看次数

如何在cshtml视图中使用WebGrid?

我可以在任何控制器中使用WebGrid,例如:

var grid = new WebGrid(emailsFetched, columnNames);

我必须在我的ASP.NET MVC项目中添加一个引用System.Web.Helpers.

但是当我尝试直接在视图中使用这个网格时(为了避免控制器中的实例化和其他设置),它说:The type or namespace 'WebGrid' cannot be found.好的,我也尝试在这里添加一个引用:

@using System.Web.Helpers 但这引发了另一个问题:

There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in the machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

这很奇怪......我在网上看到了足够的例子,它们正在使用WebGrid并且不必在cshtml视图中声明任何内容......

你能告诉我怎么解决这个问题吗?或者为什么我遇到这个非常丑陋的问题?

asp.net-mvc webgrid razor

10
推荐指数
2
解决办法
3万
查看次数

如何在Slick中定义可选外键?

我有这样一张桌子:

object Addresses extends Table[AddressRow]("address") {
   def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
  def street = column[String]("street")
  def number = column[String]("number")
  def zipcode = column[String]("zipcode")
  def city = column[String]("city")
  def country = column[String]("country")
  def geoLocationId = column[Int]("geo_location_id", O.Nullable)

 // Foreign keys.
 def geoLocation = foreignKey("fk_geo_location", geoLocationId, GeoLocations)(_.id)

 // Rest of my code.
 ...
}
Run Code Online (Sandbox Code Playgroud)

我的案例类在哪里:

case class AddressRow(
  id: Option[Int] = None,
  street: String,
  number: String,
  zipcode: String,
  city: String,
  country: String,
  geoLocationId: Option[Int])
Run Code Online (Sandbox Code Playgroud)

你注意到geoLocation是一个可选的外键....

我在外键定义中找不到任何描述这个"可选"的方法.

我尝试过:

  def geoLocation = foreignKey("fk_geo_location", …
Run Code Online (Sandbox Code Playgroud)

scala slick

8
推荐指数
2
解决办法
3901
查看次数