Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8373479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:41:07+00:00 2026-06-09T14:41:07+00:00

I’m trying to use jquery in asp.net mvc3. I’m using EditorTemplates for the list.

  • 0

I’m trying to use jquery in asp.net mvc3. I’m using EditorTemplates for the list. My model is as

public class staffinfo
{
    public int staffid { get; set; }
    public double extgrade { get; set; }
    public string lvlid { get; set; }
    public IList<SelectListItem> level { get; set; }
    public string grdid { get; set; }
    public IList<SelectListItem> grade { get; set; }
    public double pf { get; set; }       
    public double wages { get; set; }
    public List<hrfacility> facility { get; set; }

}

public class hrfacility
{
    public int id { get; set; }
    public string name { get; set; }
    public double price { get; set; }        
    public int staffid { get; set; }
    public string staffname { get; set; }               
    public double amount { get; set; }
    public bool selected { get; set; }
}

View:

...
@Html.EditorFor(m => m.wages)    
@Html.EditorFor(m=>m.facility) 

EditorTemplate for hrfacility

@model Mysol.Models.hrfacility
...
@Html.DisplayFor(m=>m.name)
@Html.CheckBoxFor(m=>m.selected)    
@Html.EditorFor(m => m.staffname)
@Html.EditorFor(m => m.amount)

 <script type="text/javascript">
    $('#staffname').attr('readonly', true);
</script>

I’ve used the above procedure without the list part in editortemplates and the jquery works fine but for this particular situation it is not working!!

Is it because there might be more than one staffname??

How can i make jquery work for the above situation (make staffname readonly)??

P.S. readonly is just for the example purpose. I need to do other things as well with jquery like assigning the value to the textbox. If i can get this work, i think i can do other things as well.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:41:08+00:00Added an answer on June 9, 2026 at 2:41 pm

    It does not work because the id of the input for staffname should be something like facility_0_staffname , facility_1_staffname and so on.

    You better add a class to the staffname input and access it with that class.

    You may check the id with Firebug (on Firefox)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.