小编rdu*_*ont的帖子

Text inputs with maxlength not validating with jQuery Validate

I'm stuck with a problem using jQuery Validate. The thing is I have a few textboxes with their maxlength attributes set. Although they are not required, they still fail to validate when either empty or whitespace.

Sample HTML:

<input type="textbox" id="tbx1" maxlength="100" value="" />

Then, $('#tbx1').valid() returns false. Shouldn't it return true instead? Are there any known workarounds for this?

Oh, and adding $('#myform').validate({ ignore: '#tbx1' }); doesn't quite work for me, because I'm using ASP.NET controls with their …

jquery jquery-validate

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

SqlDataReader.Read()总是返回false

我有以下情况:

using (SqlConnection conexao = new SqlConnection(ConnectionString))
{
    SqlCommand comando = new SqlCommand(query, conexao);
    comando.Parameters.AddWithValue("id", idUsuario);
    conexao.Open();
    SqlDataReader reader = comando.ExecuteReader(CommandBehavior.SingleRow);
    if (reader.Read())
    {
        Hydrate(out entity, reader);
    }
}
Run Code Online (Sandbox Code Playgroud)

那么,如果reader包含有效结果HasRows == true,那么reader.Read()应该返回true,对吗?

嗯,它不适合我.我不知道发生了什么,因为Hydrate(out entity, reader);线路永远不会被击中.

有人可以帮我理解这个吗?

谢谢!

.net sqldatareader

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

标签 统计

.net ×1

jquery ×1

jquery-validate ×1

sqldatareader ×1