Would like to load a datagrid already in edit mode instead of having the user click the edit button

Discussion in 'ASP .Net Datagrid Control' started by Frank Kurka, Mar 30, 2005.

  1. Frank Kurka

    Frank Kurka Guest

    Now my asp.net datagrid shows an edit button and clicking it puts the datagrid in edit mode.

    I would like to:

    1) possilby load the page already in edit mode (implies some kind of OnLoad command to the datagrid to put it in edit mode before it is rendered and sent)

    and

    2) have a button outside the datagrid to initiate edit, update , etc. that does not require the button to have a datagrid as the parent (as the buttons inside the datagrid have).

    Thanks in advance.
    Frank Kurka, Mar 30, 2005
    #1
    1. Advertising

  2. Frank Kurka

    Elton Wang Guest

    Hi Frank,

    It's not clear what your idea is.

    What you mentioned inside button can invoke a specified
    row (clicked) into edit state. So how do you specify which
    row will be edited, especially you want to directly into
    edit state from page load?

    Hope you can give more detailed info about your idea.

    Elton Wang



    >-----Original Message-----
    >Now my asp.net datagrid shows an edit button and clicking

    it puts the datagrid in edit mode.
    >
    >I would like to:
    >
    >1) possilby load the page already in edit mode (implies

    some kind of OnLoad command to the datagrid to put it in
    edit mode before it is rendered and sent)
    >
    >and
    >
    >2) have a button outside the datagrid to initiate edit,

    update , etc. that does not require the button to have a
    datagrid as the parent (as the buttons inside the datagrid
    have).
    >
    >Thanks in advance.
    >
    >
    Elton Wang, Mar 30, 2005
    #2
    1. Advertising

  3. Frank Kurka

    Frank Kurka Guest

    Well, there are 2 ideas here (both related to datagrid)

    1) when a datagrid is built and loaded .. it is already in a "normal state".
    You can add template edit with a button that the user can click to reload it
    and rerender it in an edit state, but only after the user clicks on it.

    I would like the datagrid loaded already in an edit state (like forms used
    to do) ..as if the user had clicked edit alredy, before the page even loaded
    so the user can do ahead and edit whenhe firsty sees it without having to
    click the edit button first.

    2) For the second idea .. I am just trying to move the edit (or update)
    button outside the datagrid so it canappear somehwere else on the page ...

    This is really about single record datagrids (and datalists) where there is
    only one record involved ... no need for one per row (only one involved)

    Hope this is clearer .. hard to explain sometimes ...

    "Elton Wang" <> wrote in message
    news:024d01c534c3$c98e9940$...
    > Hi Frank,
    >
    > It's not clear what your idea is.
    >
    > What you mentioned inside button can invoke a specified
    > row (clicked) into edit state. So how do you specify which
    > row will be edited, especially you want to directly into
    > edit state from page load?
    >
    > Hope you can give more detailed info about your idea.
    >
    > Elton Wang
    >
    >
    >
    > >-----Original Message-----
    > >Now my asp.net datagrid shows an edit button and clicking

    > it puts the datagrid in edit mode.
    > >
    > >I would like to:
    > >
    > >1) possilby load the page already in edit mode (implies

    > some kind of OnLoad command to the datagrid to put it in
    > edit mode before it is rendered and sent)
    > >
    > >and
    > >
    > >2) have a button outside the datagrid to initiate edit,

    > update , etc. that does not require the button to have a
    > datagrid as the parent (as the buttons inside the datagrid
    > have).
    > >
    > >Thanks in advance.
    > >
    > >
    Frank Kurka, Mar 30, 2005
    #3
  4. Frank Kurka

    Elton Wang Guest

    If I understand correctly, you actually want a Multi-row
    updating datagrid. In that case you can directly put
    textbox, dropdownlist, and checkbox in TemplateColumn +
    ItemTemplate tags (except key column). So the whole
    datagrid is editable. Then you have a normal button on
    page to implement updating operation.

    HTH

    Elton Wang


    >-----Original Message-----
    >Well, there are 2 ideas here (both related to datagrid)
    >
    >1) when a datagrid is built and loaded .. it is already

    in a "normal state".
    >You can add template edit with a button that the user can

    click to reload it
    >and rerender it in an edit state, but only after the user

    clicks on it.
    >
    >I would like the datagrid loaded already in an edit state

    (like forms used
    >to do) ..as if the user had clicked edit alredy, before

    the page even loaded
    >so the user can do ahead and edit whenhe firsty sees it

    without having to
    >click the edit button first.
    >
    >2) For the second idea .. I am just trying to move the

    edit (or update)
    >button outside the datagrid so it canappear somehwere

    else on the page ...
    >
    >This is really about single record datagrids (and

    datalists) where there is
    >only one record involved ... no need for one per row

    (only one involved)
    >
    >Hope this is clearer .. hard to explain sometimes ...
    >
    >"Elton Wang" <> wrote

    in message
    >news:024d01c534c3$c98e9940$...
    >> Hi Frank,
    >>
    >> It's not clear what your idea is.
    >>
    >> What you mentioned inside button can invoke a specified
    >> row (clicked) into edit state. So how do you specify

    which
    >> row will be edited, especially you want to directly into
    >> edit state from page load?
    >>
    >> Hope you can give more detailed info about your idea.
    >>
    >> Elton Wang
    >>
    >>
    >>
    >> >-----Original Message-----
    >> >Now my asp.net datagrid shows an edit button and

    clicking
    >> it puts the datagrid in edit mode.
    >> >
    >> >I would like to:
    >> >
    >> >1) possilby load the page already in edit mode (implies

    >> some kind of OnLoad command to the datagrid to put it in
    >> edit mode before it is rendered and sent)
    >> >
    >> >and
    >> >
    >> >2) have a button outside the datagrid to initiate edit,

    >> update , etc. that does not require the button to have a
    >> datagrid as the parent (as the buttons inside the

    datagrid
    >> have).
    >> >
    >> >Thanks in advance.
    >> >
    >> >

    >
    >
    >.
    >
    Elton Wang, Mar 30, 2005
    #4
  5. Frank Kurka

    Frank Kurka Guest

    Nope .. that is not it ... Not multi row at all - single row.

    In the case you are describing ....the drop down list box is still within
    the geographic region of the datagrid.

    That means the buttons will be within the datagrid not somewhere else on the
    page.

    I want to put the update, edit, etc buttons somewhere else on the page -
    outside of the datagrid and its template area.

    The code for update, etc .. is looking for object and event parameters that
    are not available to buttons and links outside of the datagrid, but are
    provided by buttons within the datagrid.

    The other case, is realted in that .. I want to in effect "simulate" that
    the edit button was pressed on the pages initial load .. which i'm assuming
    could be done if I can get the propre reference to the datagrid and call
    some method to put it in the "edit sate"

    Is that any clearer?

    (Thanks for trying)


    "Elton Wang" <> wrote in message
    news:0bf201c5353c$a0c3e5f0$...
    > If I understand correctly, you actually want a Multi-row
    > updating datagrid. In that case you can directly put
    > textbox, dropdownlist, and checkbox in TemplateColumn +
    > ItemTemplate tags (except key column). So the whole
    > datagrid is editable. Then you have a normal button on
    > page to implement updating operation.
    >
    > HTH
    >
    > Elton Wang
    >
    >
    > >-----Original Message-----
    > >Well, there are 2 ideas here (both related to datagrid)
    > >
    > >1) when a datagrid is built and loaded .. it is already

    > in a "normal state".
    > >You can add template edit with a button that the user can

    > click to reload it
    > >and rerender it in an edit state, but only after the user

    > clicks on it.
    > >
    > >I would like the datagrid loaded already in an edit state

    > (like forms used
    > >to do) ..as if the user had clicked edit alredy, before

    > the page even loaded
    > >so the user can do ahead and edit whenhe firsty sees it

    > without having to
    > >click the edit button first.
    > >
    > >2) For the second idea .. I am just trying to move the

    > edit (or update)
    > >button outside the datagrid so it canappear somehwere

    > else on the page ...
    > >
    > >This is really about single record datagrids (and

    > datalists) where there is
    > >only one record involved ... no need for one per row

    > (only one involved)
    > >
    > >Hope this is clearer .. hard to explain sometimes ...
    > >
    > >"Elton Wang" <> wrote

    > in message
    > >news:024d01c534c3$c98e9940$...
    > >> Hi Frank,
    > >>
    > >> It's not clear what your idea is.
    > >>
    > >> What you mentioned inside button can invoke a specified
    > >> row (clicked) into edit state. So how do you specify

    > which
    > >> row will be edited, especially you want to directly into
    > >> edit state from page load?
    > >>
    > >> Hope you can give more detailed info about your idea.
    > >>
    > >> Elton Wang
    > >>
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Now my asp.net datagrid shows an edit button and

    > clicking
    > >> it puts the datagrid in edit mode.
    > >> >
    > >> >I would like to:
    > >> >
    > >> >1) possilby load the page already in edit mode (implies
    > >> some kind of OnLoad command to the datagrid to put it in
    > >> edit mode before it is rendered and sent)
    > >> >
    > >> >and
    > >> >
    > >> >2) have a button outside the datagrid to initiate edit,
    > >> update , etc. that does not require the button to have a
    > >> datagrid as the parent (as the buttons inside the

    > datagrid
    > >> have).
    > >> >
    > >> >Thanks in advance.
    > >> >
    > >> >

    > >
    > >
    > >.
    > >
    Frank Kurka, Mar 30, 2005
    #5
  6. Frank Kurka

    Elton Wang Guest

    OK single row.

    So suppose there are 10 rows in a datagrid. When in page
    load, how do you know which row the user wants to select
    to edit, before the user click any button?

    Although there is only one row involved, the important
    question is that which row is involved.

    What I mentioned dropdownlist is not for row selection.
    It's the same as textbox for a field data, only limit the
    data in select range.

    HTH

    Elton Wang


    >-----Original Message-----
    >Nope .. that is not it ... Not multi row at all - single

    row.
    >
    >In the case you are describing ....the drop down list box

    is still within
    >the geographic region of the datagrid.
    >
    >That means the buttons will be within the datagrid not

    somewhere else on the
    >page.
    >
    >I want to put the update, edit, etc buttons somewhere

    else on the page -
    >outside of the datagrid and its template area.
    >
    >The code for update, etc .. is looking for object and

    event parameters that
    >are not available to buttons and links outside of the

    datagrid, but are
    >provided by buttons within the datagrid.
    >
    >The other case, is realted in that .. I want to in

    effect "simulate" that
    >the edit button was pressed on the pages initial load ..

    which i'm assuming
    >could be done if I can get the propre reference to the

    datagrid and call
    >some method to put it in the "edit sate"
    >
    >Is that any clearer?
    >
    >(Thanks for trying)
    >
    >
    >"Elton Wang" <> wrote

    in message
    >news:0bf201c5353c$a0c3e5f0$...
    >> If I understand correctly, you actually want a Multi-row
    >> updating datagrid. In that case you can directly put
    >> textbox, dropdownlist, and checkbox in TemplateColumn +
    >> ItemTemplate tags (except key column). So the whole
    >> datagrid is editable. Then you have a normal button on
    >> page to implement updating operation.
    >>
    >> HTH
    >>
    >> Elton Wang
    >>
    >>
    >> >-----Original Message-----
    >> >Well, there are 2 ideas here (both related to datagrid)
    >> >
    >> >1) when a datagrid is built and loaded .. it is already

    >> in a "normal state".
    >> >You can add template edit with a button that the user

    can
    >> click to reload it
    >> >and rerender it in an edit state, but only after the

    user
    >> clicks on it.
    >> >
    >> >I would like the datagrid loaded already in an edit

    state
    >> (like forms used
    >> >to do) ..as if the user had clicked edit alredy, before

    >> the page even loaded
    >> >so the user can do ahead and edit whenhe firsty sees it

    >> without having to
    >> >click the edit button first.
    >> >
    >> >2) For the second idea .. I am just trying to move the

    >> edit (or update)
    >> >button outside the datagrid so it canappear somehwere

    >> else on the page ...
    >> >
    >> >This is really about single record datagrids (and

    >> datalists) where there is
    >> >only one record involved ... no need for one per row

    >> (only one involved)
    >> >
    >> >Hope this is clearer .. hard to explain sometimes ...
    >> >
    >> >"Elton Wang" <>

    wrote
    >> in message
    >> >news:024d01c534c3$c98e9940$...
    >> >> Hi Frank,
    >> >>
    >> >> It's not clear what your idea is.
    >> >>
    >> >> What you mentioned inside button can invoke a

    specified
    >> >> row (clicked) into edit state. So how do you specify

    >> which
    >> >> row will be edited, especially you want to directly

    into
    >> >> edit state from page load?
    >> >>
    >> >> Hope you can give more detailed info about your idea.
    >> >>
    >> >> Elton Wang
    >> >>
    >> >>
    >> >>
    >> >> >-----Original Message-----
    >> >> >Now my asp.net datagrid shows an edit button and

    >> clicking
    >> >> it puts the datagrid in edit mode.
    >> >> >
    >> >> >I would like to:
    >> >> >
    >> >> >1) possilby load the page already in edit mode

    (implies
    >> >> some kind of OnLoad command to the datagrid to put

    it in
    >> >> edit mode before it is rendered and sent)
    >> >> >
    >> >> >and
    >> >> >
    >> >> >2) have a button outside the datagrid to initiate

    edit,
    >> >> update , etc. that does not require the button to

    have a
    >> >> datagrid as the parent (as the buttons inside the

    >> datagrid
    >> >> have).
    >> >> >
    >> >> >Thanks in advance.
    >> >> >
    >> >> >
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
    Elton Wang, Mar 30, 2005
    #6
  7. Frank Kurka

    Frank Kurka Guest

    Hi:

    You can control how many rows are involved by carefully constucting the sql
    that pulls the row from the database .. so that there is only ... or you can
    make a datagrid using a datasource that only has 1 record .. that is not the
    real issue so let's not get hung up on that. Also, the button issue is
    involved for both datagird (1 to n records) or datalist (1 to n records) .
    the template buttons for edit, update, cancel etc are geographically located
    within the confines of the datagrid and not necessarily where a designer
    would wnat them (say all on the left)

    Becasuse the standard code that supports edit, update, save, etc expects
    that the ovject and event are passed in .. any button outside the data
    object can't pass that info in .. so you can't call the routines from a
    button outside the data container.

    The solution should be to somehow get a reference to the datagrid, or to
    hidden versions fo the buttons, or something .. but I haven't been able to
    figure it out.


    The other idea, of rendering the datagrid already in edit mode is similar ..
    acting as if the user already clicked on edit before loading the page.




    "Elton Wang" <> wrote in message
    news:074101c5356f$b4285030$...
    > OK single row.
    >
    > So suppose there are 10 rows in a datagrid. When in page
    > load, how do you know which row the user wants to select
    > to edit, before the user click any button?
    >
    > Although there is only one row involved, the important
    > question is that which row is involved.
    >
    > What I mentioned dropdownlist is not for row selection.
    > It's the same as textbox for a field data, only limit the
    > data in select range.
    >
    > HTH
    >
    > Elton Wang
    >
    >
    > >-----Original Message-----
    > >Nope .. that is not it ... Not multi row at all - single

    > row.
    > >
    > >In the case you are describing ....the drop down list box

    > is still within
    > >the geographic region of the datagrid.
    > >
    > >That means the buttons will be within the datagrid not

    > somewhere else on the
    > >page.
    > >
    > >I want to put the update, edit, etc buttons somewhere

    > else on the page -
    > >outside of the datagrid and its template area.
    > >
    > >The code for update, etc .. is looking for object and

    > event parameters that
    > >are not available to buttons and links outside of the

    > datagrid, but are
    > >provided by buttons within the datagrid.
    > >
    > >The other case, is realted in that .. I want to in

    > effect "simulate" that
    > >the edit button was pressed on the pages initial load ..

    > which i'm assuming
    > >could be done if I can get the propre reference to the

    > datagrid and call
    > >some method to put it in the "edit sate"
    > >
    > >Is that any clearer?
    > >
    > >(Thanks for trying)
    > >
    > >
    > >"Elton Wang" <> wrote

    > in message
    > >news:0bf201c5353c$a0c3e5f0$...
    > >> If I understand correctly, you actually want a Multi-row
    > >> updating datagrid. In that case you can directly put
    > >> textbox, dropdownlist, and checkbox in TemplateColumn +
    > >> ItemTemplate tags (except key column). So the whole
    > >> datagrid is editable. Then you have a normal button on
    > >> page to implement updating operation.
    > >>
    > >> HTH
    > >>
    > >> Elton Wang
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Well, there are 2 ideas here (both related to datagrid)
    > >> >
    > >> >1) when a datagrid is built and loaded .. it is already
    > >> in a "normal state".
    > >> >You can add template edit with a button that the user

    > can
    > >> click to reload it
    > >> >and rerender it in an edit state, but only after the

    > user
    > >> clicks on it.
    > >> >
    > >> >I would like the datagrid loaded already in an edit

    > state
    > >> (like forms used
    > >> >to do) ..as if the user had clicked edit alredy, before
    > >> the page even loaded
    > >> >so the user can do ahead and edit whenhe firsty sees it
    > >> without having to
    > >> >click the edit button first.
    > >> >
    > >> >2) For the second idea .. I am just trying to move the
    > >> edit (or update)
    > >> >button outside the datagrid so it canappear somehwere
    > >> else on the page ...
    > >> >
    > >> >This is really about single record datagrids (and
    > >> datalists) where there is
    > >> >only one record involved ... no need for one per row
    > >> (only one involved)
    > >> >
    > >> >Hope this is clearer .. hard to explain sometimes ...
    > >> >
    > >> >"Elton Wang" <>

    > wrote
    > >> in message
    > >> >news:024d01c534c3$c98e9940$...
    > >> >> Hi Frank,
    > >> >>
    > >> >> It's not clear what your idea is.
    > >> >>
    > >> >> What you mentioned inside button can invoke a

    > specified
    > >> >> row (clicked) into edit state. So how do you specify
    > >> which
    > >> >> row will be edited, especially you want to directly

    > into
    > >> >> edit state from page load?
    > >> >>
    > >> >> Hope you can give more detailed info about your idea.
    > >> >>
    > >> >> Elton Wang
    > >> >>
    > >> >>
    > >> >>
    > >> >> >-----Original Message-----
    > >> >> >Now my asp.net datagrid shows an edit button and
    > >> clicking
    > >> >> it puts the datagrid in edit mode.
    > >> >> >
    > >> >> >I would like to:
    > >> >> >
    > >> >> >1) possilby load the page already in edit mode

    > (implies
    > >> >> some kind of OnLoad command to the datagrid to put

    > it in
    > >> >> edit mode before it is rendered and sent)
    > >> >> >
    > >> >> >and
    > >> >> >
    > >> >> >2) have a button outside the datagrid to initiate

    > edit,
    > >> >> update , etc. that does not require the button to

    > have a
    > >> >> datagrid as the parent (as the buttons inside the
    > >> datagrid
    > >> >> have).
    > >> >> >
    > >> >> >Thanks in advance.
    > >> >> >
    > >> >> >
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
    Frank Kurka, Mar 31, 2005
    #7
  8. Frank Kurka

    Ian Guest

    The long and short of it is that, prior to the initial DataBind, you
    need to figure out which row you want to be in edit mode. Once you
    know that simply set the DataGrid.EditItemIndex to the index of that
    row and DataBind() and voila, that row will be in Edit mode.

    Ian
    Ian, Mar 31, 2005
    #8
  9. Frank Kurka

    Matt Guest

    "Frank Kurka" <> wrote in message
    news:...
    > Hi:
    >
    > You can control how many rows are involved by carefully constucting the
    > sql
    > that pulls the row from the database .. so that there is only ... or you
    > can
    > make a datagrid using a datasource that only has 1 record .. that is not
    > the
    > real issue so let's not get hung up on that. Also, the button issue is
    > involved for both datagird (1 to n records) or datalist (1 to n records) .
    > the template buttons for edit, update, cancel etc are geographically
    > located
    > within the confines of the datagrid and not necessarily where a designer
    > would wnat them (say all on the left)


    [trim]

    Then just before you call:


    DataGrid1.DataSouce = mycollection;

    //this is the line you need
    DataGrid1.EditItemIndex = 0; //could be 1 instead, but guessing 0 since
    index.

    DataGrid1.DataBind();


    If you've been building your datagrid solely using point and click you have
    to have a hunt in the code behind for where databind() occurs, expand the
    web generated code bit.
    Matt, Apr 29, 2005
    #9
    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. Purvi T
    Replies:
    0
    Views:
    820
    Purvi T
    Oct 19, 2004
  2. Alex
    Replies:
    0
    Views:
    396
  3. jonny
    Replies:
    2
    Views:
    641
    Masudur
    Jul 30, 2007
  4. How to load datagrid in edit mode?

    , Nov 25, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    143
    Elton Wang
    Nov 25, 2005
  5. Jaime Stuardo

    GridView control enters edit mode when I click Edit link twice

    Jaime Stuardo, Apr 7, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    377
    Jaime Stuardo
    Apr 7, 2006
Loading...

Share This Page