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 6677059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:04:13+00:00 2026-05-26T04:04:13+00:00

I got a table and i assign the click event via .live() to each

  • 0

I got a table and i assign the click event via .live() to each td (id=”min”) in every row

View:

            <td id="min">
                @Html.Action("GetMinAmount", "Stock", new { id = item.FoodID })
            </td>      

Controller (to display either image or amount)

     // Function to return min amount, if null return "-"
    public string GetMinAmount(int id)
    {
        var food = dbEntities.FOODs.Single(f => f.FoodID == id);
        string output = "";
        if (food.MinAmount == null)
        {
            output += "<img id=\"disable\" src=\"../../Content/Add_in_Images/disable.png\" alt=\"disable\" style=\"background-image: none\"/>";
        }
        else
        {
            return food.MinAmount.ToString();
        }
        return output;
    }

Script:

       $('#min').live('click', function () { $editdialog.dialog('open'); });

But inside the td I can have 2 conditions, one is the “enabled” state which showing the Amount where user can click and edit the amount. If the amount is null, an icon will be displayed and user cannot do anything with it.

Currently I cant remove the click handler for the disabled image. So even the td which suppose to be disabled is clickable also…

I got no idea how can i remove the click handler for the “disabled” td only.

Anyone can help??? 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-05-26T04:04:13+00:00Added an answer on May 26, 2026 at 4:04 am

    I somehow change my controller to do it in a “dirty” way i would say?

     // Function to return min amount, if null return "-"
        public string GetMinAmount(int id)
        {
            var food = dbEntities.FOODs.Single(f => f.FoodID == id);
            string output = "";
            if (food.MinAmount == null)
            {
                output += "<img class=\"disable\" src=\"../../Content/Add_in_Images/disable.png\" alt=\"disable\" style=\"background-image: none\"/>";
            }
            else
            {
                output += "<h4 class=\"edit\">" + food.MinAmount + "</h4>";
            }
            return output;
        }
    

    Just putting my amount in a wrapper and I assign the click event to the td with the amount only…

       $('.edit').live('click', function () {
    

    Any suggestion regarding this ??

    Appreciate all the feedback… Thanks….

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

Sidebar

Related Questions

I've got the following in my view: <%= Html.DropDownList(Schema.MetaData.SourceTableName, new SelectList(Model.Schema.MetaData.SourceTableNames, Model.Schema.MetaData.SourceTableName), Model.SourceTablesOptionLabel)%> SourceTableNames
Got this: Table a ID RelatedBs 1 NULL 2 NULL Table b AID ID
got a table with dates and prices. Date Price 2012-01-01 25 2012-01-05 12 2012-01-10
I got a table that saves executed purchase orders. For a report I want
I got a table with a custom TableCellEditor (extending DefaultCellEditor) with a JFormattedTextField as
I got a table where in got allocated space of 3gig but have no
i got a table inside a table like <table class=xyz> <tr> <td> <table> <tr>
I've got a table with repeating IDs which I will fix later. Basically I
I've got a table that looks like this: CREATE TABLE CustomerXmlData (CustomerId int, CustomerData
If I've got a table containing Field1 and Field2 can I generate a new

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.