[CLOSED] Popup with grid and values from entity framework /razor/mvc

  1. #1

    [CLOSED] Popup with grid and values from entity framework /razor/mvc

    Hi,

    I wonder if you have a sample code for a popup window with a grid with
    values from entity framework, where I can doubleclick a row which then
    will be entered in a corresponding textfield.
    I'm working with MVC4/ EXT.NET/SVN RAZOR EF5

    Any help would be nice.

    Regards,
    Holger

    EDIT:
    I want to clarify my question :
    I'm having a autogenerated model from a database (EF5).
    The entity classes derive from EntityObject.

    In the examples I see Ext.Net.MVC.FieldAttribute.
    Should I wrap all the entity-classes or is there an easy way
    to use the entity classes from entity framework ?
    Last edited by Daniil; Oct 12, 2012 at 6:05 AM. Reason: [CLOSED]
  2. #2
    Hi @zwf,

    There is a new feature that has been recently implemented - StoreFor. It allows to automatically build a Store according a data. It can also deals with Model.

    Here you can find a simple example.
    <Ext.Net v2 sources root>\Ext.Net.MVC.Examples\Areas\Models\Views\StoreFor\Index.cshtml
    The StoreFor method has some overloads. Please choose an appropriate one.

    There is also a shortcut for StoreFor that takes Model - StoreForModel.
  3. #3

    Works fine, except .....

    the fact, that eg.:

                                                fp_transportierter_items.Add(
                                                Html.X().FieldContainer()
                                                .ID("fieldcontainer2")
                                                .Layout("HBoxLayout")
    
                                                .Items(fc1 =>
                                                {
    
                                                    fc1.Add(
                                                        Html.X().TextFieldFor(m => m.ES_TRANS_NAME)
                                                        .ID("txt_ES_TRANS_NAME")
                                                        .Width(180)
                                                        .LabelAlign(LabelAlign.Top)
                                                        .FieldLabel("Nachname des Transportierten")
                                                    );
    where m.ES_TRANS_NAME = "Test" in the database,
    leads to a Textfield with the value "Test "
    which means some 40 spaces after the value, which
    makes clicking in the field in the browser a little painful.

    How can I prevent this ?

    Regards,
    Holger
  4. #4
    I am afraid I don't understand the issue well.

    which means some 40 spaces after the value
    Where does these spaces come from?

    Could you provide a sample to reproduce?
  5. #5

    entity framework

    Hi,

    forget about it. It something weird with EF.
    After writing to the database, it adds the spaces up to the full lenght
    of the field (NVARCHAR(50)).

    I don't know why ......

    Regards,
    Holger
  6. #6
    Does the doc for NVARCHAR exactly for your database server tell anything on this? Maybe, it is documented behavior...
  7. #7
    Quote Originally Posted by Daniil View Post
    Does the doc for NVARCHAR exactly for your database server tell anything on this? Maybe, it is documented behavior...
    It seems to be a feature, not a bug.
    This happens, when you have nchar as datatype.
    I read, that this behaviour doesn't happen with nvarchar.

    I'll try this out .......

    Regards,
    Holger
  8. #8
    Good luck!:) It would be worth to know a result.

Similar Threads

  1. Entity Framework SQL question
    By Tookey21 in forum Open Discussions
    Replies: 0
    Last Post: Jul 05, 2012, 2:07 PM
  2. Replies: 0
    Last Post: Dec 01, 2011, 6:34 AM
  3. Replies: 0
    Last Post: Oct 23, 2011, 5:37 PM
  4. Error entity framework and ajaxmethod
    By manelj in forum 1.x Help
    Replies: 4
    Last Post: May 16, 2009, 7:25 AM
  5. Coolite using Entity Framework
    By Zarzand in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 30, 2008, 9:42 PM

Posting Permissions