GridView CommandField Button is not firing

It is for .NET 3.5 web application.
I am using asp:CommandField in the GridView for updating the GridView rows.It is working fine in the local machine.
When it published on the server the CommandField button is not firing.

What might be the possible reasons. How to fix it.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First thing I would do is look in the event manager on the server and see if any errors are being thrown. Second thing is to adding logging to narrow down the problem.  For example, is the problem happening before, during, or after the event handler is being called.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kamal KhaleefaInformation Security SpecialistCommented:
tryo to trace your code at each point by inserting something into database


sub my button click ......
insertToDB("Enter My Code")

your code
insertToDB("Execute My Code")

also check if you are using ajax that every thing is set and configured
KavyaVSAuthor Commented:
gv1_RowEditing event gets fired when CommandField button gets clicked.I am rebinding the data here.
 protected void gv1_RowEditing(object sender, GridViewEditEventArgs e)
            gv1.EditIndex = e.NewEditIndex;

I am using the RowDataBound event in GridView.In the GridView RowDataBound event I am enabling CommandField edit button based on user authorization.
   protected void gv1_RowDatabound(object sender, GridViewRowEventArgs e)
            GridViewRow gRow = e.Row;    
            if (gRow.RowType == DataControlRowType.DataRow)
                DataRowView drv = (DataRowView)e.Row.DataItem;
                if (IsAuthorized)
                    gRow.Cells[2].Enabled = true;

                    gRow.Cells[2].Enabled = false;



The GridView RowDataBound event is firing each time button is clicked(I am rebinding the Grid in each button click)
How to make RowDataBound event get fired only on Page_Load if (!PostBack) condition satisfied.

Is it because GridView RowDataBound event code the CommandField Update and Cancel buttons are not showing when CommandFiled clicked.

Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Jitendra PatilSr.Software EngineerCommented:
try removing your bindgrid() function from the gv1_RowEditing event.
KavyaVSAuthor Commented:
I removed the bindgrid() function from the gv1_RowEditing event.  Then it is not showing the
Update and Cancel buttons and also the controls not turned into editable Text Boxes.
Kamal KhaleefaInformation Security SpecialistCommented:
Try to add the condition if row data type=datarow
To gv row data bound
Jitendra PatilSr.Software EngineerCommented:
you can also check for the commandbutton on the backend code and do your processing, try the below links
GridView.RowCommand Event
How to: Respond to Button Events in a GridView Control
hope this helps.
KavyaVSAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.