We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Find Control(checkbox) inside RowBtnTemplate in GridGrouping Control in Codebehind

Thread ID:

Created:

Updated:

Platform:

Replies:

105292 Sep 26,2012 07:49 AM UTC Jan 4,2013 09:18 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Venkatsubbarao
Asked On September 26, 2012 07:49 AM UTC

Hi,
 
How can i find Control (Checkbox) inside RowBtnTemplate in GridGroupingControl in Code behind, it can be in RowDataBound or in any private method...
 
Regards,
Venkat.

Gowri S [Syncfusion]
Replied On September 27, 2012 06:45 AM UTC

Hi Venkat,

 

Thanks for using Syncfusion Products.

 

We can achieve your requirements by using the following lines in CheckedChanged event as :

 

CheckBox checkbox = (CheckBox)sender;

 

and in RowDataBound event we can achieve using RowDataBoundEventArgs  as :

 

GridRow gr = e.Row;

          

CheckBox chk = (CheckBox)gr.Cells[0].Controls[0].FindControl("cbRowBtnTemplate");

 

Please let us know if you have any concerns.

 

Regards,

 

Gowri S.


Owen Waldrep
Replied On January 2, 2013 10:06 PM UTC

How do I iterate through the grid and find controls from code behind.  I need to access the control in each row, not just the control that fired the event and I am not doing it from RowDataBound.

Bala Murugan A.S [Syncfusion]
Replied On January 4, 2013 09:18 AM UTC

Hi Owen Waldrep

Thanks for using Syncfusion products.

Your requirement of finding and accessing control(checkbox) inside RowBtnTemplate in each grid rows can be achieved by iterating through the rows of the Grid. Please refer to the code snippet below to achieve this.

[CodeBehind]

   protected void Button1_Click(object sender, EventArgs e)

        {

            foreach (TableRow row in this.ggc1.TopLevelTable.Rows) //Loop through each row of a grid

            {

                GridRow gvr = row as GridRow;

                if (gvr != null)

                {

                    foreach (GridCell gridCell in gvr.Cells)

                    {

                        if (gridCell is GridCellTemplated) // If grid cell is templated

                        {

                            CheckBox check = (CheckBox)gridCell.FindControl("cbRowBtnTemplate"); //find checkbox control inside templated grid cells

                            if (check != null)

                            {

                                if (check.Checked == true)

                                {

                                    //process here

                                }

                            }

                        }

                    }

                }

            }

        }

 

Please refer to the below link to download the sample application.

WebApplicationTest.zip

Please let me know if you have any concern.

Regards,

Bala Murugan A.S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;