0

I'm new to asp.net mvc 5 and I want to trigger a button do something. Here is my cshtml:

...
                    <tr>
                        <td><a href="#" class="btn btn-block btn-xs btn-primary"><span class="glyphicon glyphicon-align-right"></span> Räume Anzeigen</a></td>
                        <td><a href="#" class="btn btn-block btn-xs btn-primary"><span class="glyphicon glyphicon-align-right"></span> Fahrzeuge Anzeigen</a></td>
                        <td><a href="#" class="btn btn-block btn-xs btn-primary"><span class="glyphicon glyphicon-align-right"></span> Computer Anzeigen</a></td>
                        <td><a href="#" class="btn btn-block btn-xs btn-primary"><span class="glyphicon glyphicon-align-right"></span> Kontakte Anzeigen</a></td>
                    </tr>
...

I used bootstrap. In my Controller I have this method: For Example the first button must do this:

public ActionResult Rooms()
{
    DataTable table = getDummyRooms();

    ViewBag.table = table;

    return View("Index");
}
1
  • use a Url.Action ? Commented Mar 15, 2016 at 14:13

2 Answers 2

1

Use Url Action e.g. this would invoke MyController and Rooms action method :

<a href="@Url.Action("Rooms", "MyController")">Rooms</a>
Sign up to request clarification or add additional context in comments.

Comments

1

Use Url.Action in your href.

<a href="@Url.Action("Rooms","ControllerName")">...</a>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.