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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:01:10+00:00 2026-06-06T02:01:10+00:00

I have a partial view of a row for the table. Each row in

  • 0

I have a partial view of a row for the table. Each row in the table describes an element. An element can have child elements, but if it is a child element it cannot have it’s own children. In the table, there is a row for each parent element, and a list of all of it’s child elements. I am working on having a link next to the child elements that they can click, and it will no longer be a child. So it needs to be removed from the list, and a row added to the table under the parent element you just took it out of. I have the following javascript funciton that correctly updates the element in the database to no longer have a parent and removes it from the list.

    function removeElementFromParent(id, parentid) {
        if (confirm("Are you sure you want to remove this element from the group?")) {
            $.post('@Url.Content("~/Pack/RemoveElementFromParent")', { "elementid": id });
            $('#' + id).remove();
        }
    }

to create the row and insert it, I tried to do:

$('@Url.Action("~/Pack/ElementRow", new { elementid = id })').insertAfter('#' + parentid);

but that won’t work since you cannot use the javascript variable id within @Url.Action(…). I have used the $('#id').load(@Url.Action(...)); to load data as it is requested. I tried to do something similar, but since we don’t have a defined place to load it, that wasn’t going to work in this case. Also, you still wouldn’t be able to use javascript variables.

if there is a better way to do this, some help would be greatly appreciated


EDIT

Here is my solution:

$('<tr id="' + id + '"></tr>').insertAfter('#' + parentid);
$('#' + id).load('@Url.Action("ElementRow")' + '?elementid=' + id);
  • 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-06T02:01:12+00:00Added an answer on June 6, 2026 at 2:01 am

    If you want to use the javascript variable with Url.Action than you should to write something like this

    $('@Url.Action("~/Pack/ElementRow")' + "?elementid=" + id).insertAfter('#' + parentid);
    

    Hope this will fix you problem.

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

Sidebar

Related Questions

I have a partial view taskrow that will return a table row, I am
I have a partial view which contain JavaScript and Ajax, but does not run
in a partial view I have the following: <%Html.RenderAction(MVC.User.GetComments(Model.UserGroupName)); %> can I render a
I have a parent view and a partial view, but when it try to
I have a partial view which is displayed on a non-HTTPS page, but POSTS
I have in my view a partial containing a partialLoop. But when I run
My application is in ASP.net MVC3. I have a table of elements. An element
I have a partial view that I want to basically take care of itself
I have a partial view that is shared between two controllers and I'm trying
I have a partial view (UserControl) that implements a simple pager in my Asp.Net

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.