Page parameters bug?

Created a page to display contact details that accepts parameter of ContactId. Configured a link from a calling page to pass ContactId. This works fine. However, if that link is deleted in the calling page the target page header is modified to remove the parameter:
@page "/show-contact/{ContactId}" --> @page "/show-contact"
while the designer file for the same target page retains reference to ContactId, eg:
protected async System.Threading.Tasks.Task Load()
{
var noicDbGetContactByContactIdResult = await NoicDb.GetContactByContactId(Int32.Parse(ContactId));
contact = noicDbGetContactByContactIdResult;
}

This obviously causes a build error.

I don't understand why the calling page has any impact on the target page - surely the parameters as defined in the target should remain ? (this page could be potentially called from multiple pages). I would, of course, expect an error if I forget to pass the parameter from the calling page.

Am I missing something here?

Thanks.

Can you explain what you mean by this?

Do you have any screenshots you can share? Im having a hard time understanding. :slight_smile:

Thanks for your reply. Sorry my description is a little unclear.
This is the link defined in a page "Companies" (created using template editor):


The target page (Show Contact) has the following configuration:
image

This works fine. The Razor code generated for the Show Contact page has the following header:
image
The code behind for the same page (razor.designer.cs) contains appropriate code to pass the ContactId parameter (as outlined in my original message above).
If I delete the link defined in the Companies page then the header in the ShowContact (.razor) page is updated to exclude the ContactId parameter (also as described above). The razor.designer.cs code for the same page is not updated to remove reference to ContactId resulting in the build error.
My expectation would be that changes to the link defined in the Companies page should have no impact on the ShowContact page.
This came to light when I decided (for formatting) to code the Url link directly using HTML rather than the Url tool in the Radzen app.

Let me know if you need any more details.
Many thanks.

1 Like

Now I get it.

I have noticed the same thing and its easy to explain. On a page you cannot set what type of parameters that page accepts, the only way to do this is by doing what you do now. "Opening" a page via a component and from there say what parameters the page accepts. So you are doing it the right way. What i am hoping for in the future is that you can per page say what parameters that page accepts and then we wont have this issue.

(Iยดm really sorry for my bad english, not my main language :wink: )

Back to solving your problem, you want to show some type of contact that you get by passing in a contact id right? Why would you delete that path if you want to use it?

Lets solve this!

At the moment Radzen determines what parameters a page has by checking all Navigate to and Open dialog actions that use that page. If you remove such an action a corresponding parameter is no longer created. We will probably change that in the next major version of Radzen.

2 Likes

Hey thanks for your reply. I deleted the link so I could manually create it to include in HTML within a card for better control over the layout. Think the best solution, given Korchevs' update below is to include the URL component but then hide this. That way the code is generated correctly and you can continue creating custom HTML layout. What do you think?
Cheers

I think the point that needs to be addressed at the moment is what appears to be an actual bug - rather than feature. Deleting the link from the calling page updates the header in the target but not the code behind (so generating build errors).
Thanks again for your input.

We have two different list pages where we navigate to edit pages through a link in a template in one of the columns, which passes the Id-parameter. It took me a long while to figure out why one of the edit pages wouldn't include the Id parameter in the page path in the razor file, turns out it was because we had an old version of one of the list pages using the row select for navigation.

Question: Could you fix so that Radzen checks templates for navigate to / open dialog actions as well? So we don't have to add phantom navigations :slight_smile:

Radzen should already check in templates but we may have missed some. What component are you using?

It's a link component
image

In what Template is this link placed?

It's a template in one of the columns of a datagrid.

Does it work if you use a button and Navigate To action? I suspect we don't process links at the moment.

I'm not sure, I can check it out when I got the time another day. But I guess you are right on the links.