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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:56:49+00:00 2026-05-27T02:56:49+00:00

Scenario: I have a View and inside that view I also a partial view.

  • 0

Scenario:
I have a View and inside that view I also a partial view.
On the main view I have two textbox and a button. When user enters data and clicks on the button, data added to database and displays in a tabular format in the partial view.

The partial view also has a delete link for each row. To support that delete, I had to use “jquery.unobtrusive-ajax.min”.

Problem:
When I click the button to save data, everything on the view goes insane. The whole page becomes double. Please see the image.
But If I remove the reference of “jquery.unobtrusive-ajax.min”, the problem does not exists (delete doesnt work then though).

Anyone aware of this behavior, how to solve it??
enter image description here

The main view:

<%Html.EnableClientValidation(); %>
<% using (Ajax.BeginForm("Create","Program",new AjaxOptions{UpdateTargetId="CreateData"}))
{ %>
<div id="CreateData">
    <div>
        <%:Html.LabelFor(m=>m.Year) %>
    </div>
    <div>
        <%:Html.TextBoxFor(m=>m.Year) %>
    </div>
    <div>
        <table>
            <tr>
                <td><%:Html.LabelFor(m=>m.Time) %></td>
                <td><%:Html.LabelFor(m=>m.Title) %></td>
                <td></td>
            </tr>
            <tr>
                <td><%:Html.TextBoxFor(m => m.Time)%></td>
                <td><%:Html.TextBoxFor(m=>m.Title) %></td>
                <td><input type="image" value="Register"     src="../../Content/images/btnAdd.png"/></td>
            </tr>
        </table>
    </div>
</div>
<div>
    <div id="result">

    </div>
</div>

<div class="clear"></div>
<script type="text/javascript">
    $(function () {
        var year = $("#Year").val();
        $('#result').load('/Program/Browse?year=2012');
    });
</script>
<%} %>

PartialView:

<table>
    <% foreach (var item in Model)
       {%>
       <tr>
            <td style="width:150px"><%:Html.Encode(item.Time) %></td>
            <td><%:Html.Encode(item.Title) %></td>
            <%--<td><%:Html.ActionLink("Delete","Delete",new {ID=item.ID}) %></td>--%>
            <td><%:Ajax.ActionLink("Delete", "Delete", new { id = item.ID }, new AjaxOptions
                                                                         {
                                                                            Confirm = "Are you sure you     want to delete?",
                                                                            OnComplete = "deleteCompleted",
                                                                            HttpMethod = "DELETE"
                                                                        })%></td>
            <%--<a onclick="deleteRecord(<%: item.ID %>)" href="JavaScript:void(0)">Delete</a></td>--%>
       </tr>

    <%} %>
 </table> 

Delete Action:

        [Authorize(Roles = "Admin")]
    [AcceptVerbs(HttpVerbs.Delete)]
    public ContentResult Delete(int id)
    {
        var query = (from p in dc.Programme
                     where p.ID == id
                     select p).First();
        if (query != null)
        {
            dc.Programme.DeleteObject(query);
            dc.SaveChanges();
        }
        /*  return RedirectToAction("Create");*/
        return this.Content(" ");
    }
  • 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-27T02:56:50+00:00Added an answer on May 27, 2026 at 2:56 am

    UpdateTargetId=”CreateData” ??
    Are you sure ??
    It will replace the content of the CreateData div with the result of ProgramController.Create which is … the view containing the full form ?
    Maybe this is your problem.

    When you include jquery.unobtrusive-ajax.min, Ajax.BeginForm uses ajax.
    If you do not include it, it is working as Html.BeginForm without ajax.

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

Sidebar

Related Questions

Scenario: I have a partial view that is used in several places across my
I have jquery code that is being reused by a repeatable partial view on
In my scenario I have 2 view controllers, one tied to the main view
I have a view that contains a list of items, a TextBox and a
Ok Here is the exact scenario: I have a view named Index I have
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Ok, i have simple scenario: have two pages: login and welcome pages. im using
Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario I have two wrappers around Microsoft Office, one for 2003 and one for
Scenario: I have a text file that has pipe (as in the | character)

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.