小编Tom*_*len的帖子

Jquery抛出IE特定错误

看小提琴:

http://jsfiddle.net/JWSaZ/

这在Chrome/FF中运行良好,但在Internet Explorer中,它在Jquery文件中出错:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Timestamp: Wed, 16 Feb 2011 23:59:13 UTC


Message: Unexpected call to method or property access.
Line: 16
Char: 55207
Code: 0
URI: https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js
Run Code Online (Sandbox Code Playgroud)

jquery internet-explorer-8

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

c#替换字符串函数不返回预期结果

string message = CommonFunctions.SanitiseInput(context.Request.QueryString["msg"]);
Run Code Online (Sandbox Code Playgroud)

功能定义为:

// Sanitise input
public static string SanitiseInput(string inputText)
{
    string cleanedString = inputText;

    cleanedString.Replace("<","&lt;");      // No code
    cleanedString.Replace(">", "&gt;");
    cleanedString.Replace("&", "&amp;");    // No query string breaks

    return cleanedString;
}
Run Code Online (Sandbox Code Playgroud)

给定输入,"<b>rg</b>"返回相同,而不是"&lt;b&gt;rg&lt;/b&gt;"

c# string

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

HTML头标签顺序错误

在此输入图像描述

在这种布局中,它无效,因为H1不是第一个渲染的头部元素......这是一个可怕的罪恶还是没关系?有任何解决这个问题的方法吗?两列都是可变长度的,所以我看不到任何方式.

引文

有人让我引用这个:

http://www.w3.org/WAI/ER/IG/ert/ert-19991221.html#Technique3.5.A

应检查标题元素(H1-H6)以确保它们根据以下规则嵌套.文档中的第一个标题元素必须为H1文档中必须只有一个H1元素标题级别不得增加超过1个级别.示例:H1之后的H2是好的.H1之后的H3很糟糕.标题元素可以减少任何级别.示例:H5之后的H2可以.

html css header semantics

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

Linq选择字段

只是试验Linq:

    DataClassesDataContext db = new DataClassesDataContext();
    var q = from p in db.tblBlogEntries select p;
    foreach (var customer in q)
    {
        Response.Write(customer.ID + " " + customer.title + "\n");
    }
Run Code Online (Sandbox Code Playgroud)

工作正常,但我似乎只能返回1个字段,或者所有字段.我如何选择说,p.ID而且p.title,没有别的?

c# linq

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

为什么ASP.net使用方括号

我来自经典的ASP,我做了:

myVar = request.querystring("ID")
response.redirect("lol.asp");
Run Code Online (Sandbox Code Playgroud)

在.net中它是:

myVar = Request.Querystring["ID"];
Response.Redirect("lol.aspx");
Run Code Online (Sandbox Code Playgroud)

方括号何时用于圆形方括号?它们意味着什么?我现在有点理解它代表一个索引?

c# asp.net code-formatting asp-classic

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

c#处理datacontext

3个具有相同功能的示例:

方法1

使用大括号

public static int TicketsRequiringSupportResponse()
{
    int ReturnValue = 0;
    using (var dc = new CrystalCommon.MainContext())
    {
        ReturnValue = (dc.tblHelpCentreQuestions.Where(c => c.awaitingSupportResponse == true).Count());
    }
    return ReturnValue;
}
Run Code Online (Sandbox Code Playgroud)

方法2

使用没有大括号

public static int TicketsRequiringSupportResponse()
{
    int ReturnValue = 0;
    using (var dc = new CrystalCommon.MainContext())
        ReturnValue = (dc.tblHelpCentreQuestions.Where(c => c.awaitingSupportResponse == true).Count());
    return ReturnValue;
}
Run Code Online (Sandbox Code Playgroud)

方法3

没有大括号,并在使用区块内返回

public static int TicketsRequiringSupportResponse()
{
    using (var dc = new CrystalCommon.MainContext())
        return (dc.tblHelpCentreQuestions.Where(c => c.awaitingSupportResponse == true).Count());
}
Run Code Online (Sandbox Code Playgroud)

所有这些都妥善处理吗?方法3是最好的,代码最少,但我担心它不能正确处理,因为return语句会中断.

c# linq asp.net dispose scope

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

用这个Jquery多个选择器

我已经搜索但无法找到如何做到这一点.我正在尝试使用comment-modbox内部this隐藏和显示元素:

$('.comment-wrapper').each(function (index) {

    $(this, '.comment-modbox').mouseover(function () {
        $('.comment-modbox').show();
    });

    $(this, '.comment-modbox').mouseout(function () {
        $('.comment-modbox').hide();
    });
});
Run Code Online (Sandbox Code Playgroud)

此代码隐藏并显示所有内容,comment-modbox无论它们是否包含在内this.

谢谢你的帮助!

回答:

$('.comment-wrapper').each(function (index) {

    $(this).mouseover(function () {
        $('.comment-modbox', this).show();
    });

    $(this).mouseout(function () {
        $('.comment-modbox', this).hide();
    });
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-selectors

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

找不到"名称"的定义

我在命名空间中定义了一个类:

namespace Artworking
{
    public class Category
    {
        int ID {get;set;}
        string Name {get;set;}

        public Category(int ID, string Name)
        {
            this.ID = ID;
            this.Name = Name;
        }
        public Category(int ID)
        {
            using (CrystalCommon.MainContext db = new CrystalCommon.MainContext())
            {
                var q = (from c in db.tblArtworkTemplateCategories where c.ID == ID select c).SingleOrDefault();
                this.ID = q.ID;
                this.Name = q.CatName;
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的内容页面上,我从另一个函数中获取所有类别,并添加一个列表框控件:

        // Category select
        Artworking.Category[] Cats = Artworking.CommonFunctions.FetchAllCategories(Master.LoggedInUser.Client.ID);
        foreach(Artworking.Category C in Cats){
            ListItem NewItem = new ListItem();
            NewItem.Text = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net methods class

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

c#将linq数据库记录转换为类实例

我不确定这是否是正确的做事方式,看起来很长,我想检查这是将linq结果转换为类的好方法:

 /// <summary>
/// A job header
/// </summary>
public class JobHeader
{
    public int ID { get; set; }
    public int? UserID { get; set; }
    public int? ClientID { get; set; }
    public string JobName { get; set; }
    public string Code { get; set; }
    public DateTime? DateAdded { get; set; }
    public int? StatusID { get; set; }
    public bool UniversalQuantity { get; set; }
    public bool UniversalDelivery { get; set; }
    public bool UniversalDeliveryDates { …
Run Code Online (Sandbox Code Playgroud)

c# sql linq asp.net class

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

Linq包含运算符

这很好用:

var q = (from c in db.tblLiteCategorySpecs where CategoryIDs.Contains(c.CategoryID) select c.SpecID).Distinct().ToList();
var qq = (from s in db.tblSpecifications where q.Contains(s.id) select s);
Run Code Online (Sandbox Code Playgroud)

但是我现在需要在第一个查询中返回另一个字段:

var q = (from c in db.tblLiteCategorySpecs where CategoryIDs.Contains(c.CategoryID) select new { c.SpecID, c.FriendlyName }).Distinct().ToList();
var qq = (from s in db.tblSpecifications where q.Contains(s.id) select s);
Run Code Online (Sandbox Code Playgroud)

所以q.contains现在失败了,我需要以某种方式处理q查询SpecID字段.有人知道怎么做吗?

c# linq asp.net contains

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