views:

109

answers:

1

Ok Here is 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 which doesn't do anything else

ViewData["Message"]  = "Hi There!";

I am using ajax to load partial views from the Index.aspx so when I have the followinf url > http://localhost/Index#Sayhi sayhi partial view is called.

So all I need now is how in the controller to return this address I can't use View("Index#Sayhi") And also if I use the RedirectUrl("index#sayhi") I lose the ViewData.

Please any help is appreciated Thanks in advance.

+1  A: 

the '#' character is used for page internal bookmark links and should not be used for server side logic. so linking to a page with your #sayhi url, the browser will go to that page and scroll down to a tag like this:

<a name="sayhi"></a>

If you want to pass sayhi into the action you should use ? instead and grab it from the request.

Christian Dalager
Thank you dalager, but I use # for ajax loading of different panels (just like new facebook mechanism)
Amr Elsehemy