Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC - button to fire an Ajax.ActionLink

@Ajax.ActionLink(
    "Link Text", 
    "RefreshTestStatus2", 
    "refresh",
    new AjaxOptions { 
        UpdateTargetId = "status", 
        InsertionMode = InsertionMode.InsertBefore })

But I would like to use something that looks like a submit button to fire it. Does anyone know how to do this?

Judy

like image 457
Judy Avatar asked Dec 21 '22 16:12

Judy


2 Answers

I decided to implement it as an Ajax form.

@using(Ajax.BeginForm( 
  "RefreshTestStatus2", 
  "refresh",
  new AjaxOptions { 
    UpdateTargetId = "status", 
    InsertionMode = InsertionMode.InsertBefore }))
{
  <input type="submit" name="submit" value="Link Text" />
}

I think it's safe to say it's not as clean an Ajax.ActionLink, but gives you an input button.

like image 76
andrew.rockwell Avatar answered Jan 09 '23 06:01

andrew.rockwell


One option would be to use some css to make the link look like a button

such as this example

also see the related question here

like image 40
Richard Avatar answered Jan 09 '23 06:01

Richard