I have the follwoing HTML to show image actions inside a table element:
<%= Html.ActionLink("[EditImg]", "Edit", new { id = item.GrossBaseReconId }, new { id = "BaseReconEdit", rowsid = item.GrossBaseReconId }).Replace("[EditImg]", "<img src='/Content/images/page_white_edit.png' alt='Edit Details' title='Edit Details'>")%>
<%= Ajax.ImageActionLink("/Content/images/delete.jpg", "Delete", "DeleteElement", new { id = item.GrossBaseReconId }, new AjaxOptions { OnSuccess = "DeleteGrossBasedRecon", Confirm = "Delete Gross Recon?", HttpMethod = "Delete" })%>
I add and ed开发者_开发知识库it using JQuery and JSON and need to refresh or add to my table on POST.
My question is: Is there anyway I can use JSON to render these links into my table when I edit or insert a row?
I'm not sure how to build up the string correctly.
Thanks in advance
You will use action method returned PartialView. Create response tr/td. Update or Delete resnpose table tags and replace it. It is simple implement solution. How about?
Seems obvious - look at generated source and build up the string the way it is rendered.
var row = '<td>' + '<a href="/PaymentGross/Edit/' + data.GrossBaseReconId +'" id="BaseReconEdit" rowsid="' + data.GrossBaseReconId + '"><img src=' + "'" + '/Content/images/page_white_edit.png' + "'" + ' alt= ' + "'" + 'Edit Details' + '"' + ' title=' + "'" + 'Edit Details' + "'" + '></a>' + ' ' +
'' + '' + rest of the row
It's not pretty - any easier approaches welcome.
精彩评论