Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have registration controller with index and coursedetails actions.
in my view i have a anchor tag. when am click on the anchor tag i want to call coursedetails action. but index action is calling
this is my event in view
onclick="location.href='@Url.Action(DDMVC.Registration.coursedetails("Nevada", @item.Name))'"


please provide the answer
Posted

Do one think.
step-1>create a empty dive inside index page
Step-2>Create a onclick event for anchor tag
step-3>in the onclick event call a function that you have to create in your script.
step-4>then you can call the action with the help of $.ajax by defining the url, parameters and get or post type actions
step-5>Get the partial view result and render it in html and assign to the div in the same function.

This solution is for showing a partial view(Course details) in your index page.

but if you separately want to load the course details page then you can use action link instead of anchor tag.

If you find my answer useful then you can always click on green tick mark to accept the solution
 
Share this answer
 
Hope it will help you,

<a href="/Home/Test" >sampleclick</a>

in this url Home is a controller and Test is a method that i am calling.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900