我曾在我的項目之一這樣做過。請看看它。我正在使用Ajax.ActionLink或者我們通常使用的主要是
<% Html.Telerik().Grid<TMG.Framework.Web.MVC.Models.EnrolRegAcntDescriptor>()
.HtmlAttributes("style")
.Name("Grid")
.DataKeys(datakeys => datakeys.Add(m => m.enrollment_account_id))
.Columns(columns =>
{
columns.Bound(m => m.NPI).Width(70);
columns.Bound(m => m.PIN).Title("Legacy PIN").Width(70);
// columns.Bound(m => m.EnrolRegAcntDescriptor.bank_account_no).Title("Account No.");
columns.Bound(m => m.aba_routing_no).Title("ABA Routing");
columns.Bound(m => m.financial_inst).Title("Financial Inst").Width(50);
columns.Bound(m => m.Name).Title("Authorized User").Width(90);
columns.Bound(m => m.status).Title("Status").Width(80);
columns.Bound(m => m.EnrollmentAuthorityID).Title("");
columns.Bound(m => m.ProviderApplicantID).Title("");
columns.Bound(m => m.enrol_status_id).Title("");
columns.Template(m => m.status)
.ClientTemplate(
Ajax.ActionLink("Delete ", "DeleteEnrolAccountByID",
new
{
ProviderApplicantID = "<#=ProviderApplicantID#>",
enrol_status_id = "<#=enrol_status_id #>",
EnrollmentAuthorityID = "<#=EnrollmentAuthorityID#>",
enrollment_account_id = "<#=enrollment_account_id#>" },
new AjaxOptions { UpdateTargetId = "EnrolRegisterComplete", HttpMethod = "Delete" },
new
{
name = "deleteStatus",
status = "<#=status#>",
enrollment_account_id = "<#=enrollment_account_id#>",
EnrollAuthorityID = "<#=EnrollmentAuthorityID#>",
ProviderApplicantID = "<#=ProviderApplicantID#>",
enrol_status_id = "<#=enrol_status_id #>",
// onclick = "return confirm('Are you sure you want to delete this User?');"
}).ToHtmlString());
}).ClientEvents(ev => {ev.OnDataBound("onGridBound"); })
.DataBinding(dataBinding => dataBinding.Ajax().Select("ajaxIndex", "EnrolRegister"))
.Footer(true).Sortable()
.Scrollable()
.Pageable(pager=> pager.PageSize(10))
.Render(); %>
<script type="text/javascript" >
function onGridBound(e) {
$("a[name='deleteStatus']").each(function (e) {
if ($(this).attr("status") != 'Enrolled') {
$(this).hide();
} //, "disabled");
});
}
</script>
您使用的是服務器端還是客戶端綁定? – 2010-10-27 15:00:47
客戶端綁定。 – 2010-11-01 15:20:25