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

[Solved] MVC Grid popout edit and Entity framework

4 Answers 97 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.
Obay
Top achievements
Rank 1
Obay asked on 19 Oct 2011, 07:42 AM
Dear All

 i am  using Nerddinner approach in MVC development (entity framework ORM and repositories in models) and i have a problem in popout edit mode, i don't wont to display all model properities.

Q: Is there is any way to use telerik mvc grid popout edit mode without adding customized editable models and not display all fields?
(i dont want to scaffold all probarities of model [ie. ID, IsValid])


.readOnly() .Hidden() and selecting specific columns does not work, it displays all fields in editing.

is this related to editor templates or version?, i am using v.2011.2.712.340
Is there any workaround? or  i am missing something?

I am new in Telerik and i scanned Telerik Forums, KB, Documentation and Code Library, no luck :(


NOTE: i don't wont to use InLine Edit Mode or customized editable models.

any help will be highly appreciated.

and thanks in advance..
obay

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 19 Oct 2011, 08:39 AM
Hello Obay,

 This help topic shows how to hide properties from the grid edit form.

Regards,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Obay
Top achievements
Rank 1
answered on 19 Oct 2011, 09:51 AM
Thanks Atanas for your replay..

Yes i know that i can use this filter in model (EFfile.designer.cs) and it works(except IsValid Property), But acctually  i hoped that there is any work around in UI Layer becouse i don't want to change my models (integration with existing application).


Kind Regards
obay
0
Obay
Top achievements
Rank 1
answered on 19 Oct 2011, 11:54 AM
I think about custom popout edit template and i am working on a solution like this:

  • creating partial form typed with model object renders editable fields only.
  • creating controller method (news/editform/id) thet loads the partial with correct model.
  • creating save method to save passed model object.
  • creating telerik window that loads content from ajax (news/editform/id).
  • creating button in grid that open the window and pass the selected row id.

when i click the button it opens the window which loads (by ajax) the edit form populated with the data of selected item
+save button commits changes to save action.

the changes is in UI Layer and 2 methods in controller (which already exists in my application, and the partial too)

i hope that work :)
0
Obay
Top achievements
Rank 1
answered on 19 Oct 2011, 01:14 PM

faster solution interrupted me, i can use javascript (Grid client side event) to remove none editable elements :
(light weight UI changes)
function onEdit(e) {
     $("#IsValid").remove();
     $("label:contains('IsValid')").hide();
     $("#NewsId").remove();
     $("label:contains('NewsId')").hide();
  }

It worked fine , but is this reliable?
Note: I am developing application similar to CMS frameworks, and i am working on first version (BETA) and exploring technologies.
Tags
Grid
Asked by
Obay
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Obay
Top achievements
Rank 1
Share this question
or