2

I've got:

 return RedirectToAction("ManageCampaigns", new { campaignID = Model.LeadSalesCampaignID });

Which works fine. It sends the user to ManageCampaigns?campaignID=1. But now, I want to send the user to:

ManageCampaigns?campaignID=1#divID

What would the syntax be to make this happen?

Casey Crookston
  • 13,016
  • 24
  • 107
  • 193

1 Answers1

3

Instead of using RedirectToAction return a RedirectResult using the Url.Action() method and format the string with the div id.

Such as

return Redirect($"{Url.Action("ManageCampaigns", new { campaignID = Model.LeadSalesCampaignID })}#divId");

Url.Action will capture your action url as a string and then you simply append the div id to the end of it.

Nico
  • 12,493
  • 5
  • 42
  • 62