How to return view in MVC with url like this http: // localhost / admin # sayhi
Ok Here's the exact scenario:
I have a view named Index I have a partial view (user control) named SayHi I have an AdminController which has an action named SayHi that does nothing
ViewData["Message"] = "Hi There!";
I am using ajax to load partial views from Index.aspx so when I have followinf url> http: // localhost / Index # Sayhi sayhi partial view is called.
So, all I need now is how to return this address in the controller. I can't use View ("Index # Sayhi") And also if I use RedirectUrl ("index # sayhi") I lose ViewData.
Please appreciate any help Thanks in advance.
source to share
The "#" character is used for page links with bookmarked pages and should not be used for server side logic. so by referencing a page with your #sayhi url the browser will navigate to that page and scroll down to a tag like this:
<a name="sayhi"></a>
If you want to pass sayhi
to an action, which one should you use? instead and take it from the request.
source to share