I have a gridview that contains an 'edit' command button.
The problem is that when I click the this 'edit' command button it does not work from the first time,I must click it 2 times to enable edit mode.
I want help to make it enable edit mode from the first time.
I am using VS.NET 2005.

this is the code that I am using to enable editing mode:

 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
    }

Thanks in advace.

I THINK it's better to give poskback to the grid .... try this

I think you are binding the gridview inside a IF not ISPOSTBACK ----END IF code in Page Load.

Paste it outside this on Page Load.

This should do the trick.

Call the GridView1.DataBind() method after setting the edit index inside the GridView1.RowEditing event handler

Can u tell me how 2 do this (postback).
thnx in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.