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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:22:19+00:00 2026-05-29T20:22:19+00:00

I have a webgrid and for each rows I have a link that I

  • 0

I have a webgrid and for each rows I have a link that I use to open a fancybox to modify the row.

Here the webgrid on a partialview :

@model IEnumerable<PDSI.Model.Models.Vaccin>
@{
var gridVaccins = new WebGrid(source: Model);

}
@gridVaccins.GetHtml(
 tableStyle: "general_table",
 columns:
    gridVaccins.Columns(
        gridVaccins.Column(
            columnName: "Vaccin_Type",
            canSort: false,
            header: "Type"
        ),
        gridVaccins.Column(
            canSort: false,
            columnName: "Vaccin_Site",
            header: "Site",
             format: (item) => item.Vaccin_Site.Site
        ),
        gridVaccins.Column(
            canSort: false,
            columnName: "Date_Recu",
            header: "Date reçue",
            format: (item) => item.Date_Recu == null ? "" :   item.Date_Recu.Date.ToLongDateString()
        ),
        gridVaccins.Column(
            canSort: false,
            columnName: "Refuse",
            header: "Refusé",
            format: (item) => item.Refuse ? @Html.Raw("oui") : @Html.Raw("non")
        ),
        gridVaccins.Column(
            canSort: false,
            header: "",
            format: @<a class="editVaccin" href="/Patient/EditVaccin/@item.Id">Modifier</a>
        ),
         gridVaccins.Column(
            canSort: false,
            header: "",
            format: @<a href="/Patient/DeleteVaccin/@item.Id">Supprimer</a>
        )
 )
 )
<script type="text/javascript">
  $('a.editVaccin').fancybox();
 </script>

When I click on the link It goes to this controller :

    public ActionResult EditVaccin(int id)
    {
        var model = _vaccinServices.GetVaccin(id);

        ViewBag.VaccinSite = _vaccinServices.GetVaccinSite();
        return PartialView("VaccinEditor", model);
    }

The first time I click it I goes into the controller to get my model, but after I modify the row and save the model from the fancybox and update the table, if i click a second time on the link “Modifier” to modify the same row, it doesn’t go into the controller (EditVaccin). The href isn’t working on the second click.

The second click only open the fancybox with the model info we got from the first click only.

This only happens in IE 8-9, in Google chrome it’s working properly, but I have to use IE. So what I need to do to make it work?

This is the view where my webgrid is :

            <div style="width: 100%;">
                <a id="addVaccin" href="/Patient/AddVaccin/">Ajouter un vaccin</a>
                <br />
                <br />
                <div id="main_vaccins">@Html.Action("GetVaccins")</div>
            </div>
<script type="text/javascript">
$('a#addVaccin').fancybox();
</script>

This is the controller that load the partial view with the webgrid :

    public ActionResult GetVaccins()
    {
        var listVaccins =    _vaccinServices.GetVaccinsByPatient(SessionContext.IdPatient);
        return PartialView("VaccinsTable", listVaccins);
    }

The partialview to edit a row :

@model PDSI.Model.Models.Vaccin
<script src="../../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
@using (Html.BeginForm())
{ 
@Html.ValidationSummary(true)

<fieldset>
    <legend>Vaccin</legend>
    @Html.HiddenFor(model => model.Id_Patient)
    @Html.HiddenFor(model => model.Id)
    <table>
        <tr>
            <td>@Html.LabelFor(model => model.Vaccin_Type)
            </td>
            <td>@Html.TextBoxFor(model => model.Vaccin_Type, new { @maxlength = "20" })
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(model => model.Vaccin_Site.Site)
            </td>
            <td>@Html.DropDownList("Vaccin_Site.Id", new SelectList(ViewBag.VaccinSite as System.Collections.IEnumerable, "Id", "Site", Model.Vaccin_Site.Id))
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(model => model.Date_Recu)
            </td>
            <td>
                @Html.TextBox("Date_Recu", Model.Date_Recu == null ? "" : Model.Date_Recu.Value.ToLongDateString(), new { @class = "date" })
                @Html.ValidationMessageFor(model => model.Date_Recu)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(model => model.Refuse)
            </td>
            <td>@Html.CheckBoxFor(model => model.Refuse)
            </td>
        </tr>
    </table>
    <p>
        <input type="submit" value="Enregistrer" /></p>
</fieldset>
}

<script type="text/javascript">
$(document).ready(function () {
    $("#tabs").tabs();
    $('.date').datepicker();
});
$('form[action="/Patient/AddVaccin/"]').submit(function (event) {
    $.ajax({
        url: "/Patient/AddVaccin/",
        type: "POST",
        dataType: 'html',
        data: $('form[action*="/Patient/AddVaccin/"]').serialize(),
        success: function (result) {
            $.fancybox.close();
            $('#main_vaccins').text('');
            $('#main_vaccins').html(result);
        },
        complete: function () {

        },
        error: function (error) {
            alert(error.toString());
        }
    });
    event.preventDefault();
});

$('form[action*="/Patient/EditVaccin/"]').submit(function (event) {
    $.ajax({
        url: "/Patient/EditVaccin/",
        type: "POST",
        dataType: 'html',
        data: $('form[action*="/Patient/EditVaccin/"]').serialize(),
        success: function (result) {
            $.fancybox.close();
            $('#main_vaccins').text('');
            $('#main_vaccins').html(result);
        },
        complete: function () {

        },
        error: function (error) {
            alert(error);
        }
    });
    event.preventDefault();
});
</script>

The controller (httpost) for the edit :

    [HttpPost]
    public ActionResult EditVaccin(Vaccin model)
    {

            _vaccinServices.Edit(model);
            return RedirectToAction("GetVaccins");

    }

Thank you for the help

  • 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-29T20:22:21+00:00Added an answer on May 29, 2026 at 8:22 pm

    Finally this is doing the job!

    $("a.editVaccin").fancybox({ajax: {cache: false}});
    

    IE kept the partialview in cache that why the second click on the link only open the partialview without going back to the controller.

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

Sidebar

Related Questions

I'm trying to use a WebGrid to display data in my model and am
I am trying to populate a WebGrid cell with an image that will open
I have a WebGrid tied to a model. In my model I have a
I'm new to MVC so have some conceptual issues. I have a WebGrid that
Have an app that can use tts to read text messages. It can also
I have an mvc3 webgrid that contains results that I would like to filter
I have webgrid using a scrollbar plugin ( link ), It looks great initially,
i've a trouble, i need a webgrid with a form for each row, i
I'm using asp.net webGrid in which i have two buttons which both open same
I want to explain this as best as I can. I have a Webgrid

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.