ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
ClientFormat not sending row data
Title:
B
I
{code}
?
I'm trying to use ClientFormat to create a link to a controller and pass data just like you did in the demo page. I've even copied the exact line you have to show how the Id is passed back to the controller, but instead of mine pulling data from the row, it's sending the literal ".(Id)" value. When I inspected the element on the demo, I see this: <a href="/GridDemo/OpenDetails/503">open</a> But when I inspected the element in my project, I see this: <a href="/CRUD/DownloadFile?id=.%28Id%29">open</a>
Save Changes
Cancel
Sean Davidson
asked at 06 May 2022
maybe you don't have an `Id` property in you row model, you can check in the Chrome Web tool Network tab the ajax result, or use grid api `console.log($('#gridId').data('api').model($('#gridId').find('.awe-row').first())` usually the row model is formed here: https://www.aspnetawesome.com/learn/mvc/Grid#Map
at 06 May 2022
Omu
I do have an Id property in the row model and data is there when looking in the Chrome Network tab. Is the problem in the creation of the link? I don't think the problem is whether the property exists, it's that the hyperlink isn't being created correctly. Here's the definition of the ClientFormat link, is there a problem with the double and single quotes? var downloadLinkFormat = "<a href='" + Url.Action("Download", "CRUD", new { fileName = ".(Id)" }) + "'>open1</a>";
at 06 May 2022
Sean Davidson
try `downloadLinkFormat = ".(Id)"` as an experiment
at 06 May 2022
Omu
That works. And I found out what's the actual definition break. If the parameter name being sent to the action method is anything other than "id", it won't work, and I had my action method set to receive a parameter called "fileName".
at 06 May 2022
Sean Davidson
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK