-1

I'm new to mvc3. I created one web project though mvc3 . On Index page of my Customer model, i added following code which is generating the result as follows-

enter image description here

<span class="callSapn">@if (item.Calls.Count != 0)
{
@Html.Label("Calls(");
@Html.DisplayFor(modelItem => item.Calls.Count);
@Html.Label(")");
}</span>

I want to give Html.ActionLink to whole span, means the span generated result will be the title for Actionlink.

How to do this?

Priyanka
  • 2,802
  • 14
  • 55
  • 88
  • Your question is not clear. Do you want to place a hyperlink around the whole span element? – Leon Cullens Jun 26 '12 at 12:20
  • @Leon Cullens: i think u have not read my question carefully. I already mentioned in the question about what i want. – Priyanka Jun 26 '12 at 13:02
  • I did read it carefully, but it's still not clear to me what you want. Instead of blaming people who are trying to help you, you should try to make your questions clearer so everyone understands them. We're wasting our time here trying to help you, so at least you could be a bit more friendly. – Leon Cullens Jun 26 '12 at 13:05
  • @Leon Cullens: I highlighted the part of code. – Priyanka Jun 27 '12 at 05:20

2 Answers2

2

If you want to make the span element to a clickable hyperlink, you can try this

<a href="@Url.Action("YourActionName")" >
  <span class="callSapn">Your span content goes here</span>
</a>
Shyju
  • 214,206
  • 104
  • 411
  • 497
0
@Html.ActionLink(string.Format("Calls({0})", item.Calls.Count), "action_name")

If the action is in the current controller. Otherwise all the other overloads accept link text: http://msdn.microsoft.com/en-us/library/dd505040

Andras Zoltan
  • 41,961
  • 13
  • 104
  • 160