1
votes
  1. I have a column with Company Names, all items in column are links.
  2. I have a column with CompanyIds
  3. 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 }, { name: 'FirmaNavn', index: 'FirmaNavn', width: 100, align: 'center', editable: false, edittype:'select', formatter:'showlink', formatoptions:{ baselinkurl:'@Url.Action("EditReferance")'}},

2
Could you include an example (at least one row) of the data which you post back to the jqGrid during the filling of the grid? Could you additionally write HTML fragment which you try to receive?Oleg
ive updated main question with 2 rows, ive tyred with baselinkurl, which supose to send me futher to next view, but it doesnt, it says that that path does not excistsTimsen
What I need is that you write the exact format of the <a> element which you need to have. For example, that you need to have <a href="/Home/EditReferance?CompanyId=123">Microsoft</a> in the 'Company Names' column if one has 123 in the CompanyIds hidden column. So you want have the link <a href="/Home/EditReferance?CompanyId=123">Microsoft</a> for the data {CompanyId:123, Company:"Microsoft"}.Oleg
for my format it will look like <a href="/Reference/EditReferance?id=123">Sovsens</a> thats 1 line i just dont know how to auto generate it for jqgrid, and how to extract id on controller side. thank you for using so much time for me olegTimsen

2 Answers

2
votes

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")'}
0
votes

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