This is a migrated thread and some comments may be shown as answers.

Customizing "Insert form" in PopUp editing

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Igniter
Top achievements
Rank 1
Igniter asked on 18 Mar 2011, 03:46 PM
Ajax binding. i'm trying to create grid with custom Edit button, and Insert form. What is the best way?

1. While inline editing ProjectName and EventDate are editable (as supposed). But while PopUp editing all fields are being displayed. How to fix it?
2. If there are no 
columns.Command(commands =>
           
{
                commands
.Edit();
                commands
.Delete();
           
}).Width(200);
Insert form doesn't display (only X). How to display pop up for inserting without using edit, delete buttons?

3. If i use custom Edit controls, while pressing Delete I can't return grid action

        [GridAction]
        public ActionResult Delete(int id)
        {


            if (ModelState.IsValid)
            {
                repo.DeleteProject(id);
            }
          
             //ERROR return View(new GridModel(repo.GetProjects()));

            return RedirectToAction("Index");
        }
 

My model:

[ReadOnly(true)]
        public int ProjectId { get; set; }


        [Required(ErrorMessage = "*")]
        [DisplayName("Name")]
        public string ProjectName { get; set; }


        [Required(ErrorMessage = "*")]
        [DisplayName("Event date")]
        [DataType(DataType.Date)]
        public DateTime EventDate { get; set; }


        [ReadOnly(true)]       
        [DisplayName("XLS timming file")]
        public string TimmingFileName { get; set; }


        [ReadOnly(true)]
        [DisplayName("Edit")]
        public string Edit 
        {
            get
            {
                return (ProjectId == -1)
                    ? String.Empty
                    : "<a href='/Project/Details/"
                                  + ProjectId + "'>Details</a> | <a href='"
                                  + "/Project/Delete/" + ProjectId + "' >Delete</a>";
            }
        }

TIA

2 Answers, 1 is accepted

Sort by
0
Teseo
Top achievements
Rank 1
answered on 23 Mar 2011, 02:47 PM
I have the same problem #2 (error with a grid with ajax binding and without edit button).

I temporarily solved it adding the edit button and edit binding and hiding the button in the grid:

function OnMyGridDataBound() {
    $('#MyGrid .t-grid-edit').hide();
}
0
figueiredorj
Top achievements
Rank 1
answered on 04 Apr 2011, 10:05 AM
Don't know if it is what you want but...

You can add a button create on toolbar (it doesn't make any sense on inline commands also).

        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new {style="margin-left:0"}))

Hope it helps.

Cheers
Tags
Grid
Asked by
Igniter
Top achievements
Rank 1
Answers by
Teseo
Top achievements
Rank 1
figueiredorj
Top achievements
Rank 1
Share this question
or