小编Coa*_*der的帖子

单击按钮时获取元素的值,每行一个按钮

我有一个表,每行包含一个按钮和一些元素.我想在单击按钮时获取其中一些元素的值,然后将其传递给Ajax调用.

我的问题是获得这些元素的价值.

表格行如下所示:

<tr>
    <td>
        <input id="item_AllocationId" name="item.AllocationId" type="hidden" value="39">
        <input class="form-control input-width-medium text-box single-line" data-val="true" data-val-required="The Description field is required." id="item_Description" name="item.Description" type="text" value="Welcome Centre Rent">
    </td>
    <td>
        <div class="checker" id="uniform-item_GiftAidable"><span><input class="uniform checkbox" id="item_GiftAidable" name="item.GiftAidable" type="checkbox" value="true"></span></div><input name="item.GiftAidable" type="hidden" value="false">
    </td>
    <td>
        <div class="checker" id="uniform-isActive"><span class="checked"><input checked="checked" class="uniform checkbox" id="isActive" name="item.IsActive" type="checkbox" value="true"></span></div><input name="item.IsActive" type="hidden" value="false">
    </td>
    <td>
        <input class="update-allocation" type="submit" name="update-allocation" value="Update">
    </td>

</tr>
Run Code Online (Sandbox Code Playgroud)

和jQuery:

$(document).ready(function () {
    $('.update-allocation').click(function (event) {
        var isactive = $(this).parent().find('#isActive:checkbox:checked');
        alert(isactive);
    });
}); …
Run Code Online (Sandbox Code Playgroud)

html asp.net jquery razor

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

SQL Sever在SELECT中以奇怪的格式进行日期

不知道这里发生了什么,希望有人可以对此有所了解.

两个查询,几乎相同,除了第一个只选择一个日期列,而第二个选择另一个列:

SELECT TOP 1 CreationDate
FROM Receipts
WHERE CreationDate IS NOT NULL
ORDER BY 1 
Run Code Online (Sandbox Code Playgroud)

返回

CreationDate
1802-11-01 00:00:00.000
Run Code Online (Sandbox Code Playgroud)

第二个查询

SELECT TOP 1 Rct_Id, CreationDate
FROM Receipts
WHERE CreationDate IS NOT NULL
ORDER BY 1 
Run Code Online (Sandbox Code Playgroud)

返回

CreationDate
1994-02-14 00:00:00.000 
Run Code Online (Sandbox Code Playgroud)

第二个是合理的和预期的,或多或少可追溯到数据集创建时.我跑了第二套,更改了ORDER BY 1 DESC并得到了

CreationDate
5202-11-01 00:00:00.000

Rct_Id  CreationDate
714350  2015-02-27 00:00:00.000
Run Code Online (Sandbox Code Playgroud)

我真的很困惑,为什么日期会像这样在自己选择时改变.关于发生了什么的任何想法?

sql t-sql sql-server

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

标签 统计

asp.net ×1

html ×1

jquery ×1

razor ×1

sql ×1

sql-server ×1

t-sql ×1