A href to the same page with different parameter goes nowhere

A href to the same page with different parameter goes nowhere.

EDIT: I changed this completely as I misstated it badly, yet, I'm sure many have the same question.

I didn't realize that if you place an html anchor tag to the same page with a different parameter, the page will not change. You need to detect it in OnParametersSetAsync() as shown in response. (I answered my own question)

I found the answer to this, it was fairly simple. The page that I was linking to was the same page I was on with a different parameter. I had to compare the current parameter to the requested parameter in the OnParametersSetAsync() and if changed, call a routine to refresh the data. .

protected override async System.Threading.Tasks.Task OnParametersSetAsync()
{
    // This event will fire when the parameters change
    // This code alwas executes but if the cleint changes and the page deoesn't
    //  the main entry code won't be exdecuted. This should fix it by only calling on a client change.

    if (Id != client.Id)
    {
        await PopulateData();
    }

}
1 Like