I keep getting a Compilation Error and can't find matching overloaded method. I've tried a couple ways (variable, variable.toString). Below is the latest try.
When I click on the day (ex: 2) on the calendar the ActionLink should send the querystring: "Index?day=2".
@{ string dayAsString = startCount.ToString();}
<div><span>@Html.ActionLink(@startCount.ToString, "Index?day=" + dayAsString , "Event")</span></div>
Do this
The last parameter creates an anonymous object with the property
day
and valuestartCount
. ActionLink knows to convert that into a querystring using the property name and the property value.More details here http://msdn.microsoft.com/en-us/library/dd492936.aspx
Edit:
If you want to target a specific controller, do this
You can also do this
but I don't like passing
null
as a parameter.Here's a list of all the overloads: http://msdn.microsoft.com/en-us/library/dd505040.aspx
You can also just cycle in the intellisense.
This should work
replace Yourcontroller with your controller name