2

I am using MVC3 and I dont want to use Microsoft.Web.Mvc

How do I convert this code to be used in MVC3 ? The view engine is .aspx

Html.Button ("abc", "Button abc", HtmlButtonType.Button)  

and also this script

$("button[name=abc]").attr("disabled",true);  

Any feedback is appreciated ?

0

2 Answers 2

1

HTML Markup for your button:

<input type="button" name="abc" disabled="true" value="Button abc" />

ASP.NET MVC 3 does not have a built-in HtmlHelper extension method for a button. You could always easily create on:

public static class YourMvcButtonExtensionMethod
{
    public static MvcHtmlString Button(this HtmlHelper helper, string text,
                                     IDictionary<string, object> htmlAttributes)
    {
        // generate the markup for the input/button
    }
}

So you really have two options:

  1. use raw HTML markup in your View
  2. create your custom extension method (see above)
Sign up to request clarification or add additional context in comments.

Comments

0

"I am using MVC3 and I dont want to use Microsoft.Web.Mvc" That just sounds confusing...

Anyway you can use the button element instead.

<button disabled='true'>Button abc</button>

1 Comment

He's just saying that he doesn't want to use the futures DLL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.