Dear all,
I use asp:button field in my gridview

<asp:GridView ID="GV" runat="server" DataSourceID="SDSInHouseRate" Width="100%" AutoGenerateColumns="False" OnRowCommand="GV_RowCommand" OnRowCreated="GV_RowCreated">
            <Columns> 
                    <asp:buttonfield buttontype="Button" commandname="edit" text="Edit"/>
                    <asp:buttonfield buttontype="Button" commandname="approve" text="Approve"/>
                    <asp:BoundField DataField="Seq" HeaderText="Seq" SortExpression="Seq" />
                    <asp:BoundField DataField="CurrencyID" HeaderText="CurrencyID" SortExpression="CurrencyID" />
                    <asp:BoundField DataField="EffectiveDate" HeaderText="Effective Date" SortExpression="EffectiveDate" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False" />
                     <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="Remark" />
                    <asp:BoundField DataField="CreatedBy" HeaderText="CreatedBy" SortExpression="CreatedBy" />
                    <asp:BoundField DataField="DateCreated" HeaderText="Date Created" SortExpression="DateCreated" DataFormatString="{0:yyyy-MM-dd HH:mm:ss}" HtmlEncode="False"/>
                   </Columns>
            </asp:GridView>
Sub GV_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim editButton As Button = CType(e.Row.Cells(0).Controls(0), Button)
            editButton.CommandArgument = e.Row.RowIndex.ToString()

            Dim approveButton As Button = CType(e.Row.Cells(1).Controls(0), Button)
            approveButton.CommandArgument = e.Row.RowIndex.ToString()
        End If
    End Sub

Sub GV_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
        Dim Index As Integer = Convert.ToInt32(e.CommandArgument)
        Dim Row As GridViewRow = GVInHouseRate.Rows(Index)
        Session("TransMode") = StatusTrans.EditMode
        If e.CommandName = "approve" Then
            ImgApprover.Disabled = False
            CmbCCY.Enabled = False
            DTEffectiveDate.Enabled = False
            TxtInHouseRate.Enabled = False
            TxtRemark.Enabled = False
       Else
            ButtonReady()
            FillData(Val(Row.Cells(2).Text.Trim))
            ImgApprover.Disabled = True
        End If
    End Sub

The problem is, everytime I clicked 'edit' and 'approve' button in gridview, the row cell became TextBox, and can be edited by user also the date became '04/01/2009 12:00:00 AM' difference with the format.

Any suggestion ? please.

Thanks.

I do not really understand your point. because if you want to edit something and that is why you have a edit button, the row you working with should become textbox in order to edit something.

I use ButtonField not CommandField.
So, if I click 'Edit', it doesn't mean I want to edit my GridView cell. I want to edit my data in TextBoxes and DropDownList.

But I don't know whether ButtonFeld has the same function with CommandField

<asp:buttonfield buttontype="Button" commandname="edit" text="Edit"/> See this line...The command name of the button field is given as 'edit' which is reserved for performing edit option ..so change the command name .

This question has already been answered. Start a new discussion instead.