Friday, October 12, 2012

Create a Read-only Textbox using ASP.NET MVC Html Helper

Explore the Top Microsoft SQLServer Technical/ Interview Questions here: http://XploreSqlServer.blogspot.com/
   
Explore the Top Microsoft C# Technical/ Interview Questions here: http://XploreCSharpDotNet.blogspot.com

Explore the Top Microsoft Blazor Technical/ Interview Questions here: https://XploreBlazor.blogspot.com/

The following razor code nugget creates a read only textbox with the Id, txtCity and the value, "Chennai" :

                 @Html.TextBox("txtCity", "Chennai", new { @readonly = "readonly" })

The nugget generates the following HTML:

                 <input id="txtCity" name="txtCity" readonly="readonly" type="text" value="Chennai" />

The following nugget is to create a read only textbox bound to the model property, City :

       @Html.TextBoxFor(model => model.City, new { @readonly = "readonly" })



Explore the Top Microsoft SQLServer Technical/ Interview Questions here: http://XploreSqlServer.blogspot.com/

Explore the Top Microsoft C# Technical/ Interview Questions here: http://XploreCSharpDotNet.blogspot.com

5 comments:

  1. Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful
    AWS Training in pune
    AWS Online Training

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. "Enhance your career with salesforce administrator classes designed to teach essential platform skills. Gain hands-on experience and become a certified Salesforce professional."

    ReplyDelete
  4. "Enhance your career with salesforce dev training designed to provide hands-on experience in Apex, Visualforce, and Lightning development. Gain the skills and expertise needed to excel in the competitive Salesforce ecosystem through practical projects and expert-led sessions."

    ReplyDelete