gridview row programatically set to edit mode

Discussion in 'ASP .Net' started by =?Utf-8?B?R2VyaGFyZA==?=, Sep 29, 2006.

  1. How can I set a row in a gridview programatically to edit mode (rather than
    having to have the user click the edit row command), so the fields can be
    edited and the Update and Cancel buttons display instead of Edit?

    Thanks.
     
    =?Utf-8?B?R2VyaGFyZA==?=, Sep 29, 2006
    #1
    1. Advertising

  2. Hi,

    You can do this by directly assign the row index to property EditIndex:

    protected void Button1_Click(object sender, EventArgs e)
    {
    GridView1.EditIndex = 0;
    }

    Sincerely,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications. If you are using Outlook Express, please make sure you clear the
    check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    promptly.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Sep 29, 2006
    #2
    1. Advertising

  3. Thank you for your help!

    "Walter Wang [MSFT]" wrote:

    > Hi,
    >
    > You can do this by directly assign the row index to property EditIndex:
    >
    > protected void Button1_Click(object sender, EventArgs e)
    > {
    > GridView1.EditIndex = 0;
    > }
    >
    > Sincerely,
    > Walter Wang (, remove 'online.')
    > Microsoft Online Community Support
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications. If you are using Outlook Express, please make sure you clear the
    > check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    > promptly.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
     
    =?Utf-8?B?R2VyaGFyZA==?=, Sep 29, 2006
    #3
    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. John A Grandy

    config GridView so row shows in edit mode

    John A Grandy, Feb 17, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,906
    Andrew Robinson
    Feb 17, 2006
  2. misiek
    Replies:
    3
    Views:
    47,233
    misiek
    Mar 23, 2006
  3. Replies:
    4
    Views:
    4,437
  4. 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:
    432
    Jaime Stuardo
    Apr 7, 2006
  5. 11D.Universe

    How to programatically set GridView selected row?

    11D.Universe, Jun 17, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    1,870
    Sriram Surapureddy
    Jun 20, 2007
Loading...

Share This Page