Q: How to use DataGrid in Edit Mode -- with more fields than shown?

Discussion in 'ASP .Net' started by Sky, Jan 28, 2004.

  1. Sky

    Sky Guest

    Hello:
    Another question about trying to wring functionality from a DataGrid...

    Have a DB table of "Contacts" -- 14 or more fields per record
    Show in datagrid -- but only 5 columns (First,Last, Fax, Phone, Category).
    Put an Edit column at the end...

    Now what?!
    If you go into Edit mode -- you can only edit 5 cells -- not all the rest of
    the Record's fields...not enough!

    What options are there?
    How to -- elegantly -- replace the Edit line with a nice mini custom form
    (vertical layout, not horizontal as in the DataGrid)... Can this be done
    with a DataGrid (override a single row's Render() with another scenario --
    yet somehow figure out the values on return? I've seen that you can make
    your own BoundColumn:Edit template -- but since it's for one column, you
    can't very well use it to Colspan the whole grid, and use it....

    Question: Is there a DataGrid:Edit template that could be used for this?
    Question: Is this where I should be looking at another control to do the
    job? DataList? DataRepeater?
    Question: Is there where most people popup a modal form? If so, how are they
    catching the close of it to refresh the grid?
     
    Sky, Jan 28, 2004
    #1
    1. Advertisements

  2. Sky

    Madan Nayak Guest

    A sugestion
    ========

    In this senario, The numbers of coulms you are showing should be updatble.
    There is no problem..

    I f you want to update more no of fields you are showing, you can give a
    link to another editpage.aspx which would take the primary key of the record
    clicked and show you all the necessary fields for update....

    I think this is the better approach.

    Questions:
    ======
    Why donot you show fields but want to update them?
    Is it of space problem in dispalying all your fields???
    Is there any security issue that prevetnts you from displayng...

    let me know pl.
    Thanks
    Madan
     
    Madan Nayak, Jan 28, 2004
    #2
    1. Advertisements

  3. Sky

    Sky Guest

    Dear Madan:

    The scenario I was envisioning was the following:

    One 'app-module' called QuickPhoneList of members of the company. For a
    quick lookup, most people just need the phonenumber/extension -- not the
    rest of the info on that person, such as DateFirstHired, etc. This kind of
    information is useful for other reports -- but not for the data that is the
    QuickPhoneList...

    Therefore, you only need to show 4 or 5 columns for this basic info -- but
    when the user wants to update his entry, the form should be more complete.

    I hear you as to linking to another EditPage to handle this -- I've seen it
    also done as a popup...

    But it appears to me that it should also be possible to custom design the
    rendering of the grid to 'collapse/hide the EditRow -- and inject an empty
    row, colspan = full, just below it to hold the mini edit form. The reason I
    am thinking in this direction is that if the num of fields is minimal -- eg:
    10 or so, but also it won't fit in the 4or5 columns we mentioned, maybe it's
    not always a good thing to completly lose their place in the grid (could be
    3 pages in on a paged query?) and visual context, to move them to a edit
    page just to handle this...

    Plus - I sort of have been feeling that a 'module' should be contain all
    it's pieces: the View, the Edit, the Settings. Independant from the rest of
    the framework of the pages...
    If that idea doesn't have too big a flaw to it, then maybe it should be
    possible, and possibly quite sexy to inject a mini form there. Of some
    kind. Somehow....

    Thinking about it a little more, if it can't be done by injecting a
    ColSpan=full row here to hold the mini-form, this might be a good place to
    inject a popup/iframe rather than a popup/window, to hold this
    miniframe.(forgot what those custom MS things are called)...

    What do you think?

    PS: Plus, even if not such a great idea to edit the data this way-- the
    DataGrid is such a pervasive control, that learning how to control it's
    edit/render templates to their fullest can't be bad to learn anyway!!! =;-)
     
    Sky, Jan 29, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.