This is a migrated thread and some comments may be shown as answers.
MVC Grid Popup displays on refresh when x close button clicked previously.
0 Answers 20 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alvic
Top achievements
Rank 1
Alvic asked on 19 Jan 2012, 02:27 AM
The grid works as expected for the most part.  I used this example as my model: Telerik MVC Grid Editing Server.  I am using popup edit mode and when I click the Edit or Insert button, the popup displays.  If I click the cancel button, and then either refresh the browser or click the refresh icon on the lower left of the grid, view reloads properly.  But if I click the X button on the top right of the popup, and then after the popup goes away, refresh or click the grid refresh button, the popup displays again.  So weird!

I can't for the life of me figure out why this is happening.  Here are snippets of my code:

View:
@(Html.Telerik().Grid(Model.Events)
        .Name("Grid")
        .DataKeys(keys => keys.Add(e => e.EventGUID))
        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image).ImageHtmlAttributes(new { style = "margin-left:0" }))
        .DataBinding(dataBinding => dataBinding.Server()
                .Select("Events", "Home", new { mode = GridEditMode.PopUp, type = GridButtonType.Image })
                .Insert("NewEvent", "Home", new { mode = GridEditMode.PopUp, type = GridButtonType.Image })
                .Update("SaveEvent", "Home", new { mode = GridEditMode.PopUp, type = GridButtonType.Image })
                .Delete("DeleteEvent", "Home", new { mode = GridEditMode.PopUp, type = GridButtonType.Image }))
        .Columns(columns =>
        {
            columns.Bound(e => e.EventStartDate).Width(210).Format("{0:MM/dd/yyyy hh:mm:ss}");
            columns.Bound(e => e.Created).Width(210).Format("{0:MM/dd/yyyy hh:mm:ss}");
            columns.Bound(e => e.Event_Type.Type).Width(210).Title("Event Type");
            columns.Bound(e => e.CreatedBy).Width(210);
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
            }).Width(180).Title("Commands");
        })
            .Editable(editing => editing.Mode(GridEditMode.PopUp))
        .Pageable()
        .Sortable()
)

Controller:
public ActionResult Events()
        {
            ViewBag.Message = "Events";
            List<\Event> events = db.Event.Include("Event_Type").ToList();
            EventsViewModel eventsViewModel = new EventsViewModel();
            eventsViewModel.Events = events;
            return View(eventsViewModel);
        }

Model:
public partial class Event
    {
        public Event()
       
        public System.Guid EventGUID { get; set; }
        public System.DateTime EventStartDate { get; set; }
        public System.DateTime EventEndDate { get; set; }
        public System.DateTime LastUpdate { get; set; }
        public System.DateTime Created { get; set; }
        public string CreatedBy { get; set; }
        public virtual Event_Type Event_Type { get; set; }
    }

public partial class Event_Type
    {
        public Event_Type()
        {
            this.Event = new HashSet<PMATT_Event>();
        }
    
        public short EventTypeID { get; set; }
        public string Type { get; set; }
    
        public virtual ICollection<Event> Event { get; set; }
    }
Tags
Grid
Asked by
Alvic
Top achievements
Rank 1
Share this question
or