Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

GridView CommandField Button is not firing

Posted on 2014-01-06
8
Medium Priority
?
1,396 Views
Last Modified: 2014-01-22
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.

Thanks
0
Comment
Question by:KavyaVS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 11

Accepted Solution

by:
MajorBigDeal earned 668 total points
ID: 39760837
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.
0
 
LVL 16

Assisted Solution

by:Kamal Khaleefa
Kamal Khaleefa earned 668 total points
ID: 39761195
tryo to trace your code at each point by inserting something into database

ex

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
0
 

Author Comment

by:KavyaVS
ID: 39763318
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;
            BindGrid();
        }

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;
                }

                else
                {
                    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.

Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Expert Comment

by:Jitendra Patil
ID: 39764432
try removing your bindgrid() function from the gv1_RowEditing event.
0
 

Author Comment

by:KavyaVS
ID: 39766432
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.
Thanks
0
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 39766502
Hi
Try to add the condition if row data type=datarow
To gv row data bound
0
 
LVL 13

Assisted Solution

by:Jitendra Patil
Jitendra Patil earned 664 total points
ID: 39767836
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.
0
 

Author Closing Comment

by:KavyaVS
ID: 39800645
Thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question