4
@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

Branislav Abadjimarinov
  • 5,101
  • 3
  • 35
  • 44
Judy
  • 41
  • 1
  • 1
  • 2

2 Answers2

9

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.

andrew.rockwell
  • 621
  • 7
  • 18
  • 1
    +1, answers the question directly! a submit button is ment to submit a form, hence, Ajax form! – Tomer W Apr 15 '14 at 14:39
2

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

Community
  • 1
  • 1
Richard
  • 1,804
  • 16
  • 22