开发者

How do I replace my HTML Submit button with an ActionLink?

I have a view with a submit button. I also have a few ActionLinks on the view. Everything is function right now but I want to repalce the ugly button with an ActionLink to match the rest of the controls that are part of the view.

I'm new to MVC. So开发者_如何转开发 far, I tried converting the button to a link but I need to post the form, which an actionlink wont do without some other code.

Suggestions?


If I understand the question correctly, this can be resolved with CSS along the lines of

<input type="submit" value="Save" class="submit-actionlink" />

.submit-actionlink
{
    background-color: red; /* colour to match background of other action links*/
    color: #FFF /* colour to match background of other action links */
    margin:0;
    padding:0;

    /* the ffg 3 lines are the important part*/
    border: 0px solid #FFF; 
    text-decoration: underline; 
    cursor:pointer;
    /* and whatever else */

}

(Note: I used red and white colours above so that you can visually see whats going on, will need to change though based on your look and feel)


If you use JQuery validation you can do this and still have client-side validation triggered.

<a href="#" onclick="$(this).parents('form').submit();">Submit</a>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜