This is a migrated thread and some comments may be shown as answers.

Getting Check box status of gridClientSelectColumn in Server Side

13 Answers 692 Views
Grid
This is a migrated thread and some comments may be shown as answers.
A2H
Top achievements
Rank 1
A2H asked on 11 Jul 2010, 01:42 PM
Hi,
 I am using GridClientSelectColumn for Selecting a row in a grid.i want to check whether the check box is checked or not in ServerSide.i have tried a lot but all in vain.
I am not using GridTemplateColumn since I have some restrictions for in my reqs.
Please give me some code snipets if possible
Please Help me .

Thanks,
A2H

13 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Jul 2010, 06:07 AM
Hello,


You can check for whether the Selected property of GridDataItem is "True" or "False" instead of accessing the CheckBox control and checking the Checked property.


Feel free to share the comments,
Shinu.
0
A2H
Top achievements
Rank 1
answered on 12 Jul 2010, 10:44 AM
Hi Shinu,
    Can u pls share some code snipets.I am pretty new to telerik controls.
Thanks
A2H
0
Shinu
Top achievements
Rank 2
answered on 12 Jul 2010, 01:25 PM
Hello,

I hope the sample code shown below will help you to get started.

CS:
protected void Button1_Click(object sender, EventArgs e)
{
    GridDataItem firstItem = (GridDataItem)RadGrid1.MasterTableView.Items[0]; // Get the first DataItem
    if (firstItem.Selected) // Check for whether it is selected (checked) or not
    {
        Response.Write("Selected");
    }
    else
    {
        Response.Write("Not selected");
    }
}

Also go through the following documentation:
Retrieving primary key field values for selected items


-Shinu.
0
A2H
Top achievements
Rank 1
answered on 12 Jul 2010, 02:17 PM
Hi Shinu,
    That did the trick.Now I am able to get the value of Selected columns. Thanks a lot Shinu
Thanks,
A2H
0
A2H
Top achievements
Rank 1
answered on 13 Jul 2010, 09:59 AM
Hi Shinu,
 If we have paging in gird and I have selected some rows in first paging and some rows in second rows,
 
At that time the above code is giving error.how can we incorporate paging also in this.

Thanks,
A2H
0
Thomas Derenthal
Top achievements
Rank 1
answered on 03 Nov 2014, 07:55 PM
I am finding that this only works on the first row. I have a textbox. If the clientcheckcolumn checkbox is checked, it copies a value from one column into the textbox. However, on the TextChanged server-side code, if the textbox values is changed, then I want the checkbox to uncheck.

How to programatically uncheck the checkbox if the textbox value changes? I have used the code from this example but it only works once.

What is the correct way to reference the checkbox checked property. I do not want to loop through every row, just find the checkbox.checked for the row that has had the textbox edited.

protected void AmountApproved_TextChanged(object sender, EventArgs e)
    {

        GridDataItem firstItem = (GridDataItem)gridFundingBills.MasterTableView.Items[0]; // Get the first DataItem
        if (firstItem.Selected) // Check for whether it is selected (checked) or not
        {
            firstItem.Selected = false;
        }
        else
        {
            Response.Write("Not selected");
        }


        UpdateBalances();
       
    }
0
Eyup
Telerik team
answered on 06 Nov 2014, 01:10 PM
Hello Thomas,

You can get a reference to the row using (sender as TextBox).NamingContainer as GridDataItem.
Then, you can toggle the selection of the item depending on your custom condition or find any given template control using the FindControl method.

Hope this helps. You can also achieve that on client-side.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Thomas Derenthal
Top achievements
Rank 1
answered on 14 Nov 2014, 06:18 PM
This is a little vague. I am trying to access the checked state of a gridclientselectcolumn in the TextChanged event:

<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="50px" ItemStyle-Width="50px">
                        </telerik:GridClientSelectColumn> 


protected void AmountApproved_TextChanged(object sender, EventArgs e)
    {
     //Some text has changed, now I want to see if the ClientSelectColumn checkbox is checked
     //what is the syntax?
     if (thereIsAColumnWithAuniqueNameOfClientSelectColumn.checked == true)
          {
              thereIsAColumnWithAuniqueNameOfClientSelectColumn.checked   = false;
         }
}
0
Konstantin Dikov
Telerik team
answered on 19 Nov 2014, 10:05 AM
Hello Thomas,

The correct way for handling this would be to get reference to the parent GridDataItem (using the NamingContainer property of your TextBox control) and check its Selected property. If it is set to true, this
will mean that the item is selected.

Generally, as the name clearly stated, this is a GridClientSelectColumn and you should not use that column for retrieving the selected state of an item.

You can take a look at the following help article for accessing controls in RadGrid:

Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rahul
Top achievements
Rank 1
answered on 21 Sep 2018, 12:42 PM

Hi,


I am using a GridClientSelectColumn and have a paging on my grid. I need following things on my grid.


1) Multiple selection client-side
2) If do select all from the header checkbox on page1, it should also select the rows at all other pages.
3) Deselect should deselect only the single row, not all.
4) If select a single row on and move on to any other page and now when come back to page1 the row should persist its state.


I would appreciate any help on this.

Thanks, 

Rahul

0
Eyup
Telerik team
answered on 26 Sep 2018, 07:17 AM
Hello Rahul,

You can use the following approach to preserve selection through pages:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Selecting/persisting-selected-rows-client-side

You can examine the RadGridGetAllSelectedItemsImproved.zip web site sample provided in the last post here for a practical implementation:
http://www.telerik.com/support/code-library/get-selected-items-through-all-pages#1eTU8nr-GUG8zfGgOGbIcA

I hope this will prove helpful.


Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Rahul
Top achievements
Rank 1
answered on 01 Oct 2018, 07:41 AM

Thanks, Sir. It's Working.

Also i get stuck in telerik Rad Popup: After closing popup page parent page gets scrolled automatically.

0
Eyup
Telerik team
answered on 03 Oct 2018, 01:34 PM
Hello Rahul,

You can check the suggestions and samples provided in the following post to resolve this issue:
https://www.telerik.com/forums/radgrid-jumps-to-first-line-when-selecting-row#oMKrk-s78UiZ5ik2B22pow

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
A2H
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
A2H
Top achievements
Rank 1
Thomas Derenthal
Top achievements
Rank 1
Eyup
Telerik team
Konstantin Dikov
Telerik team
Rahul
Top achievements
Rank 1
Share this question
or