Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Unable to consistently get checked rows in GridView when in UpdatePanel

$
0
0

I have a GridView located in an UpdatePanel on my webpage.  To take actions against checked rows in the GridView, I have a method that first determines if at least one row is checked.  Sometimes it works and sometimes it doesn't.  Typically the first time I check any number of rows, it returns false.  Then I recheck the rows again and it returns true and the actions begin.  After that is complete, I call GridView.Databind() to refresh the data.  At that time the evolution begins again, I have to check the rows twice for them to be captured in code as True.

int i = 0;
            foreach (GridViewRow row in GridView3.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox check = row.FindControl("CheckBox1") as CheckBox;
                    if (check.Checked)
                    {
                        i++;
                    }
                }
            }
            if (i != 0)
            {
               //do something
            }


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>