Link to home
Start Free TrialLog in
Avatar of Bob Hoffman
Bob HoffmanFlag for United States of America

asked on

MVC 4 webGrid on main view disappears when ajax.actionlink is clicked to load a partial view.

This is what I want to happen: User click an item in the grid and that items is loaded above the grid, the grid does not change.

This is what happens:  User click an item in the grid and that items is loaded above the grid, the grid disappears.

I have the grid in the main view and the item display portion in a partial view.

I'm kind of an MVC newbe, so if this in not the correct way to do this what is?

ThankssampleCode.txt
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Is this the code that has the Ajax.ActionLink that you are referring to?

   @using (Html.BeginForm("_Grid", "MyModel"))
    {
        <div>
            @grid.GetHtml(

                    columns: new[] 
                    {
                         grid.Column(header: "Id", canSort: false, format: (item) => Ajax.ActionLink(((int)item.RecId).ToString(), "_editPartial", "MyModel", new {recId = item.RecId}, new AjaxOptions { UpdateTargetId = "_editPartialDiv"})),
                })
        </div>
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bob Hoffman
Bob Hoffman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Hoffman

ASKER

Figured it out myself