Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1023111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:33:54+00:00 2026-05-16T11:33:54+00:00

Is is possible to force Grid view edit mode without using object data source,

  • 0

Is is possible to force Grid view edit mode without using object data source, I set EditIndex, but the Edit template is never shown till I change the binding to ObjectDataSource

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:33:55+00:00Added an answer on May 16, 2026 at 11:33 am

    I don’t know if you mean such an example but I hope it will be helpful:

    <asp:GridView ID="GridView1" runat="server" OnRowEditing="GridView1_RowEditing" 
        OnRowUpdating="GridView1_RowUpdating" 
        onrowcancelingedit="GridView1_RowCancelingEdit">
        <Columns>
            <asp:CommandField EditText="Edit" UpdateText="Update" ShowEditButton="true" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Label ID="lbl" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txt" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    

    Code Behind:

    public partial class _Default : System.Web.UI.Page
    {
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = ItemRepo.GetItemList();
                GridView1.DataBind();
            }
        }
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GridView1.EditIndex = e.NewEditIndex;
            GridView1.DataSource = ItemRepo.GetItemList();
            GridView1.DataBind();
        }
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridView1.EditIndex = -1;
            GridView1.DataSource = ItemRepo.GetItemList();
            GridView1.DataBind();
        }
        protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            GridView1.EditIndex = -1;
            GridView1.DataSource = ItemRepo.GetItemList();
            GridView1.DataBind();
        }
    }
    
    class Item
    {
        public string Name { get; set; }
    }
    class ItemRepo
    {
        public static List<Item> GetItemList()
        {
            List<Item> list = new List<Item>();
            list.Add(new Item() { Name = "Item1" });
            list.Add(new Item() { Name = "Item2" });
            list.Add(new Item() { Name = "Item3" });
            list.Add(new Item() { Name = "Item4" });
            list.Add(new Item() { Name = "Item5" });
            return list;
        }
    }
    

    I think your problem can be not databinding the gridview after setting editindex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this may be a very simple question, but is it possible to force a
Is it possible to force links to open in a new window/tab using javascript
Possible Duplicate: Force Download an Image Using Javascript Basically I want to have the
Is it possible to force Ruby to call an initialize method when using YAML.load_file?
How is it possible to force extra spacing between some nodes using Linq to
Is it possible to force the user to view a commercial before the actual
is it possible to force dropdown list to fire OnSelectedIndexChanged event without AutoPostBack=True? i
Is it possible to force window to switch between normal and full-screen mode by
Is it possible to force all clients to update using socket.io? I've tried the
Is it possible to force MongoDB to show the binary data instead of displaying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.