小编mso*_*hie的帖子

在ASP.NET页面中使用jQuery查找文本框

我有<asp:TextBox runat="server" ID="lastName" />一个页面,我想用jQuery设置焦点,但它没有返回它.我的代码是这样的:

$.ready() {
    var tb = $('lastName').focus(); // don't work, why?
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net jquery

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

为什么这种扩展方法不起作用?

我不能做我想做的事.我只想要非国际代表的账户.但是当我调用ActiveAccounts()时,我没有得到null,我得到一个可枚举的,然后包含null.我在这做错了什么?请帮忙.

public static class AccountExt
{
    public static IEnumerable<Account> ActiveAccounts( this AccountRep rep )
    {
        if( rep == null )
            throw new ArgumentNullException();
        if( rep.IsInternational )
            yield return null;

        foreach( var acc in rep.FetchAccounts() )
        {
            if( acc.IsActive )
                yield return acc;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# extension-methods .net-3.5

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

标签 统计

c# ×2

.net ×1

.net-3.5 ×1

asp.net ×1

extension-methods ×1

jquery ×1