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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:56:35+00:00 2026-06-11T16:56:35+00:00

I am developing MVC 3 application and using razor syntax. In this application I

  • 0

I am developing MVC 3 application and using razor syntax.

In this application I am giving comment facility.

I have added a partial view, which loads the comment/Records from DB.

Now, I have added the Comment link in every row of Grid/Table.
When user click on that comment link, it loads the partial view which contains group of controls for Adding comments.

Check below screen.

enter image description here

Now the problem is, when user click on the comment link, every row’s comment’s partial view get opens…

Please check below screen.

enter image description here

I want to open only one partial view of the row where user clicked…

How do I do ?

I have below code….

 @model PagedList.IPagedList <CRMEntities.Location>


@{
    ViewBag.Title = "Index";
}

<div id="LocationListPageWise">
<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Remark
        </th>
        <th>
            State
        </th>
        <th>
            Region
        </th>
        <th>
            PinCode
        </th>
        <th>
            Country
        </th>
        <th>
            City
        </th>
        <th>
            Owner
        </th>
        <th>


        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Remark)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.State)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Region)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PinCode)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Country)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.City)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Owner.FirstName)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })

            <span>@Ajax.ActionLink("Comments", null, null, null, new { id = item.Id, @class = "AddComments" })</span>   

            <div class="CommentBox"></div>
            <span class="CommentAdd"></span>

            <span class="LinkSeparator"></span>
        </td>
        <td>
          <span id="flagMenus">
            @Html.Action("ShowFlag", "Flagging", new { entityId=item.Id, entityType="Location"})
         </span>
        </td>
    </tr>
}






</table>
</div> 

<div class="PagingBox">
        @Html.Action("CreateLinks", "Pager", new { hasPreviousPage = Model.HasPreviousPage, hasNextPage = Model.HasNextPage, pageNumber = Model.PageNumber, pageCount = Model.PageCount })

 </div>

<div style="float:left;width:100%;margin-top:30px;">
<div style="font-weight:bold;">All location Customers with open opportunities</div>
@Html.Action("AllLocationCustomersWithOpenOpprtunity", "Customer")
</div>



 <script type="text/javascript">

     $(document).ready(function () {

         $("a.pagenumber").click(function () {

             var page = 0;
             page = parseInt($(this).attr("id"));

             $.ajax({
                 url: '@Url.Action("GetPagedLocations")',
                 data: { "page": page },
                 success: function (data) 
                 { 
                 $("#LocationListPageWise").html(data);
                 }


             });
             return false;
         });

           $(document).ready(function () {

        $('.CommentBox').hide();

        $('a.AddComments').click(function () {


            var url="@Html.Raw(Url.Action("ShowCommentBox", "Comment", new { Id = "idValue", EntityType = "Location" }))";

            url=url.replace("idValue",event.target.id);
            $('.CommentBox').load(url);

            $(this).closest('div').find('div.CommentBox').slideToggle();
            return false;
        });
     });

     });   

</script>
  • 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-11T16:56:36+00:00Added an answer on June 11, 2026 at 4:56 pm

    Don’t search for your comments box from the root element because your search matches all such element. Search starting from the click point like this:

    $(document).ready(function () {
    
            $('.CommentBox').hide();
    
            $('a.AddComments').click(function () {
    
    
                var url="@Html.Raw(Url.Action("ShowCommentBox", "Comment", new { Id = "idValue", EntityType = "Location" }))";
    
                url=url.replace("idValue",event.target.id);
                $('.CommentBox').load(url);
    
                $(this).closest('td').find('div.CommentBox').slideToggle();
                return false;
            });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing MVC application and using razor syntax. In this application I am
I am developing MVC application and using razor syntax. In this application I am
I am developing MVC application and using razor syntax. In this application I am
I am developing MVC application and using razor syntax. In this application I am
I am developing MVC application and using razor syntax. In this application I am
I am developing MVC 3 application and using razor syntax. In this application I
I am developing MVC 3 application and using razor syntax. In this application I
I am developing MVC 3 application and using razor syntax. In this application I
I am developing an ASP.Net MVC 3 Web application using Razor Views. I have
I am developing an ASP.NET MVC 3 application using C# and Razor. I have

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.