Separate edit page for a Data Grid

Discussion in 'ASP .Net Datagrid Control' started by Evan M., Jul 18, 2005.

  1. Evan M.

    Evan M. Guest

    Hello there,

    I have a data grid that's going to display a but of data that I want to
    make editable. Problem with this is that there goign to be too many
    columns, and the data grid is going to be too wide to be practical, so
    I think the best bet is just to make the editing done on a separate
    page.

    However, I'm hitting a problem with trying to figure out how to get
    this going. I'm trying to keep this programatically simple so that it's
    as easy to maintain by those unfamiliar with the code as possible, but
    solutions I start to play with in my head seem overly complex. Any help
    / suggestions on a direction to go would be greatly appreciated.

    Thanks
    Evan M.
    Evan M., Jul 18, 2005
    #1
    1. Advertising

  2. Evan M.

    Elton Wang Guest

    Hi Evan,

    You can have a ButtonColumn, e.g. CommandName = "Edit", in the datagrid. And
    in datagrid_ItemCommand event (triggerd by click Edit button) to save
    clicked DataGridItem (e.Item) to Session and open Edit page. In Edit page
    retrieve data from Session to get edit DataGridItem. Then perform your
    editing task in the page.

    HTH

    Elton Wang

    "Evan M." <> wrote in message
    news:...
    > Hello there,
    >
    > I have a data grid that's going to display a but of data that I want to
    > make editable. Problem with this is that there goign to be too many
    > columns, and the data grid is going to be too wide to be practical, so
    > I think the best bet is just to make the editing done on a separate
    > page.
    >
    > However, I'm hitting a problem with trying to figure out how to get
    > this going. I'm trying to keep this programatically simple so that it's
    > as easy to maintain by those unfamiliar with the code as possible, but
    > solutions I start to play with in my head seem overly complex. Any help
    > / suggestions on a direction to go would be greatly appreciated.
    >
    > Thanks
    > Evan M.
    >
    Elton Wang, Jul 18, 2005
    #2
    1. Advertising

  3. Hi Evan

    Solution suggested by Elton is the best way to do it, I would also like to
    suggest the same solution but instead of storing data into the session use
    context and then Transfere the request to the edit page and in edit page
    retrieve values from context.

    Context["EditItem"] = e.Item;
    Server.Transfer("Edit.aspx");

    //In edit page
    DataGridItem dgItem = (DataGridItem)Context["EditItem"];
    Populate(dgItem);

    Regards
    Fiaz Ali Saleemi
    Fiaz Ali Saleemi, Jul 19, 2005
    #3
  4. Evan M.

    Evan M. Guest

    Thanks guys for the suggestion. Will try implementing it today.

    Fiaz, when I try and access the Context class as you suggested, VS.NET
    complains to me, saying "Cannot apply indexing with [] to an expression
    of type 'System.Web.HttpContext'". Did you mean to use the
    Context.Cache collection instead?

    In either case, I think I'll stick with using the Session collection
    instead. This application runs on a local company intranet, so traffic
    limitations are negligable. As well, using session should help me avoid
    some of the multi-access issues that I've run across trying to cache my
    dataset with multiple users.

    Thanks Again
    Evan M.
    Evan M., Jul 19, 2005
    #4
  5. Hi Evan

    I have written wrong code by mistake. Actually that is Context.Items
    collection.

    Regards
    Fiaz Ali Saleemi
    Fiaz Ali Saleemi, Jul 20, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EvgueniB
    Replies:
    1
    Views:
    605
    Anthony Borla
    Dec 15, 2003
  2. Frank Fredstone
    Replies:
    1
    Views:
    424
    Jean-Francois Briere
    Jun 27, 2006
  3. Sam
    Replies:
    0
    Views:
    688
  4. Sam
    Replies:
    1
    Views:
    754
  5. Iams

    How to edit records in a grid that's within a grid

    Iams, Mar 17, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    173
Loading...

Share This Page