This is a migrated thread and some comments may be shown as answers.
perform customization in edit/add operation using popup in telerik grid in entity model
2 Answers 84 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.
supriya
Top achievements
Rank 1
supriya asked on 27 Sep 2010, 01:54 PM

I have an application in MVC in which i am using telerik grid to display the record.I am using the entity model for it. In case of edit and add operation i want to use the popup mode but i am not able to perform any customization:Hiding any column in edit mode,make some column uneditable, showing the proper validation message and maintain the edit mode ,adding any custom field apart from the database table.

In the demo a class model is used but i donot want to perform the binding through a class model but the entity framework model.

Please provide me the way to perform customization in edit/add operation using popup in telerik grid. 

2 Answers, 1 is accepted

Sort by
0
hkdave95
Top achievements
Rank 2
answered on 16 Oct 2010, 02:20 PM
Hi

I am interested in a similar approach.

Below is my Grid...

Html.Telerik().Grid<Winclone2.Web.Models.UsersModel>().Name("Users")
                            .Columns(COL =>
                            {
                                COL.Bound(UM => UM.UserName).Width(200).Title("User Name");
                                COL.Bound(UM => UM.Email).Width(200).Title("Email");
                                COL.Bound(UM => UM.CreateDate).Width(80).Title("Creation Date").Format("{0:dd/MM/yyyy HH:mm}").ReadOnly();
                                COL.Bound(UM => UM.LastLoginDate).Width(80).Title("Last Login Date").Format("{0:dd/MM/yyyy HH:mm}").ReadOnly();
                                COL.Bound(UM => UM.UserId).Hidden(true).ClientTemplate(Html.ActionLink("Edit", "EditUser", "UserController", new { lgUserId = "<#= UserId #>" }).ToHtmlString()).Title("Edit");
                            })
                            .DataKeys(DK => DK.Add(UM => UM.UserId))
                            .DataBinding(DB => DB.Ajax().Select("_SelectUsers", "Configuration")
                                                        .Update("_UpdateUsers", "Configuration"))
                            .Pageable(PAGE => PAGE.PageSize(Common.Constants.Literals.GridPageSize).Position(Common.Constants.Literals.GridPagerPosition))
                            .Filterable()
                            .Sortable(SORT => SORT.OrderBy(OB => OB.Add(UM => UM.UserName)).SortMode(GridSortMode.SingleColumn))
                            .Render();
                    %>

  1. I would like my ClientTemplate ActionLink to open a PopUp  via the View controller of EditUser.
  2. This Popup would be a Telerik Window defined in the MasterPage markup.
  3. I would like to populate the Telerik Popup using the Grid Data Model.

Do you have any examples that would help in this undertaking?

Kind Regards

David
0
Hristo Germanov
Telerik team
answered on 18 Oct 2010, 10:03 AM
Hello hkdave95,

In order to achieve your goal, you need to bind the grid with ajax editing and then to add custom buttons in a column template. Next you need to hook up to client event which will redirect to your Action method (for instance, with JQuery post). Last in success callback you need to get the HTML, rendered from the partial view, and place it into the window content.

For your convenience I have attached a sample test project, which implement the suggested approach.

Kind regards,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
supriya
Top achievements
Rank 1
Answers by
hkdave95
Top achievements
Rank 2
Hristo Germanov
Telerik team
Share this question
or