JQgrids link to an other view
- I have a column with Company Names, all items in column are links.
- I have a column with CompanyIds
- Each of those links have to send to the same View, but link have to attach its own companyId so i can use it in my view, since i need to do some stuff with companys data.
ive found that i can use this:
edittype:'select', formatter:'showlink', formatoptions:{baselinkurl:'EditReferance.cshtml'}
but it keep saying that my EditReference view does not excists.
My two columns:
name: 'id', index: 'id', width: 50, key: true, editable: true, editrules: { edithidden: false }, hidden: true }, 开发者_C百科 { name: 'FirmaNavn', index: 'FirmaNavn', width: 100, align: 'center', editable: false, edittype:'select', formatter:'showlink', formatoptions:{ baselinkurl:'@Url.Action("EditReferance")'}},
Sorry, but I don't see any important different between the code from your answer and the code from your question. The 'showlink' formatter construct the following string op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam
(see here). So if you use baseLinkUrl: '@Url.Action("EditReferance")'
or baseLinkUrl: '', showAction: '@Url.Action("EditReferance")'
you will have the same results.
You real problem was that you used **wrong case **in the names of property baseLinkUrl
of the showlink formatter. Instead of
formatter: 'showlink', formatoptions: {baseLinkUrl: '@Url.Action("EditReferance")'}
you used
formatter: 'showlink', formatoptions: {baselinkurl: '@Url.Action("EditReferance")'}
The Answer was very simple, your column should look like this:
{ name: 'FirmaNavn', index: 'FirmaNavn', width: 100, align: 'center', editable: false, edittype:'select', formatter:'showlink', formatoptions:{ baselinkurl:'', showAction: '@Url.Action("EditReferance")'}}
hope it helps to someone
精彩评论