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

  • Home
  • SEARCH
  • 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 6528397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:50+00:00 2026-05-25T09:31:50+00:00

In EditPhoto.cshtml: @model vg_music.Models.images @{ ViewBag.Title = EditPhoto; } <h2> EditPhoto2</h2> <script src=@Url.Content(~/Scripts/jquery.validate.min.js) type=text/javascript></script>

  • 0

In EditPhoto.cshtml:

@model vg_music.Models.images
@{
    ViewBag.Title = "EditPhoto";
}
<h2>
    EditPhoto2</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Ajax.BeginForm(new AjaxOptions{UpdateTargetId = "AjaxDiv"})) {
    @Html.ValidationSummary(true)
    <div id="AjaxDiv">
        @Html.Partial("EditPhotoForm")
    </div>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div> 

EditPhotoForm.cshtml:

    @model vg_music.Models.images
<fieldset>
            <legend>images</legend>
            @Html.HiddenFor(model => model.id)
            <div class="editor-label">
                @Html.LabelFor(model => model.title)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.title)
                @Html.ValidationMessageFor(model => model.title)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.comment)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.comment)
                @Html.ValidationMessageFor(model => model.comment)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.filename)
            </div>
            <div class="editor-field">
            <img src="@Url.Content("~/uploads/images/little/"+Model.filename)" alt="@Model.title"/><br />                
            </div>
            <p>
                <input type="submit" value="Сохранить" />
            </p>
        </fieldset> 

PhotosController.cs:
….

[HttpPost]
    public ActionResult EditPhoto(images obj)
    {
        if (ModelState.IsValid)
        {
            var db = new EditImagesModel();
            db.SaveImage(obj);
            if (Request.IsAjaxRequest()) //This does not work.
            {
                return PartialView("EditPhotoForm");
            }
            return RedirectToAction("EditPhotos");

        }
        return View();
    }

….

Why is not satisfied:

if (Request.IsAjaxRequest())
{
    return PartialView("EditPhotoForm");
}
  • 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-25T09:31:51+00:00Added an answer on May 25, 2026 at 9:31 am

    Why is not satisfied:

    Because you forgot to include:

    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    

    in your EditPhoto.cshtml page. And because of this the Ajax.BeginForm helper doesn’t perform any AJAX request but a simple form POST.

    Contrary to ASP.NET MVC 1.0 and 2.0 where Ajax.* helpers such as Ajax.ActionLink and Ajax.BeginForm were polluting your markup with javascript obtrusively, in ASP.NET MVC 3 they simply generate HTML5 data-* attributes on the corresponding DOM elements. This way markup and javascript is kept separate. And you need javascript to interpret those attributes. This javascript is located in the jquery.unobtrusive-ajax.js script which needs to be included.

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

Sidebar

Related Questions

I have a form in jQuery where I update all the images via a
I am having trouble passing the url of $.PhotoUpdater.doUpdate(url) to do the doUpdate function.
I am trying to replicate the functionality that users see when they go into
I am using PHP's SimpleXML to get some values out of the following XML;
I just migrated my server's photos to an S3. Everything seems to work swimmingly
So I was implementing a feature that allows users to set default profile photos
In my app, comments belong to photos and I am trying to add a
I have tried starting the camera in android using an intent, something like this:
I succeded to take a picture using the camera of a SonyEricsson.The picture taken
Basically the question is: how do i get the ImageID from a repeater 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.