我有兩個單選按鈕 - Telerik MVC網格中的批准和拒絕,也在它們上應用了jquery buttonset()。我需要檢查每行上的哪個單選按鈕。試圖在jQuery變化事件上做到這一點,但它並沒有啓動。任何想法?如何將jquery更改事件添加到網格內的單選按鈕
<div id="ApprovalDetail" class="content">
<%
//To make columns visible/invisible
string Actions = (string)ViewData["Actions"];
//To store data back in Model
for (int i = 0; i < Model.idrequest.Length; i++)
{
%>
<%=Html.HiddenFor(model => model.idrequest[i].RequestDetailsId, new {@id="hiddenRequestDetailsId"+i.ToString()})%>
<%=Html.HiddenFor(model => model.idrequest[i].Approved, new {@id="hiddenApproved"+i.ToString()})%>
<%
}
Html.Telerik().Grid(Model.idrequest)
.Name("IdRequest")
.DataKeys(dataKeys =>
{
dataKeys.Add(r => r.RequestDetailsId).RouteKey("RequestDetailsId");
}
)
.Columns(columns =>
{
columns.Bound(r => r.RequestDetailsId);
columns.Bound(r => r.EmpId);
columns.Bound(r => r.Name);
columns.Bound(r => r.Email);
columns.Bound(r => r.ADSId);
columns.Bound(r => r.Action);
columns.Bound(r => r.Role);
if (Actions != null)
{
if (Actions.Contains("Suspend"))
{
columns.Bound(r => r.SuspensionDate).Format("{0:MM/dd/yyyy}").Width(100);
columns.Bound(r => r.SuspensionReason);
}
if (Actions.Contains("Reactivate"))
columns.Bound(r => r.ReactivationDate).Format("{0:MM/dd/yyyy}").Width(100);
if (Actions.Contains("Delegate"))
{
columns.Bound(r => r.DelegateOwner);
columns.Bound(r => r.DelegationStartDate).Format("{0:MM/dd/yyyy}").Width(100);
columns.Bound(r => r.DelegationEndDate).Format("{0:MM/dd/yyyy}").Width(100);
}
}
columns.Template(r =>
{
%>
<div class="radioStyle">
<%= Html.RadioButton(r.RequestDetailsId.ToString(), 1, false, new { @id = "yes_Approve" + r.RequestDetailsId.ToString(), @group = "Approval" })%><label
for="yes_Approve<%= r.RequestDetailsId %>">Approve</label>
<%= Html.RadioButton(r.RequestDetailsId.ToString(), 2, false, new { @id = "no_Approve" + r.RequestDetailsId.ToString(), @group = "Approval" })%><label
for="no_Approve<%= r.RequestDetailsId %>">Deny</label>
</div>
<%
}).Title("Approve");
})
.Pageable(paging => paging.Enabled(true).PageSize(10))
.KeyboardNavigation()
.Filterable(filtering => filtering.Enabled(true))
.Sortable(sorting => sorting.Enabled(true))
.Groupable(grouping => grouping.Enabled(true))
.Resizable(resizing => resizing.Columns(true))
.Render();
%>
</div>
<script type="text/javascript">
$(document).ready(function() {
//visuals
$(function() {
$("#approveRequest").button();
$(".radioStyle").buttonset();
});
$('#IdRequest :radio[group=Approval]').each(function() {
$(this).change(function() { alert("aa"); });
});
</script>
這指出我的onEdit活動的正確方向。謝謝 – Matt 2012-12-12 13:00:43