Getting Check box status of gridClientSelectColumn in Server Side

14 posts, 1 answers
  1. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 11 Jul 2010 Link to this post

    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
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2010 Link to this post

    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.
  3. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 12 Jul 2010 Link to this post

    Hi Shinu,
        Can u pls share some code snipets.I am pretty new to telerik controls.
    Thanks
    A2H
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2010 Link to this post

    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.
  5. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 12 Jul 2010 Link to this post

    Hi Shinu,
        That did the trick.Now I am able to get the value of Selected columns. Thanks a lot Shinu
    Thanks,
    A2H
  6. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 13 Jul 2010 Link to this post

    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
  7. Thomas Derenthal
    Thomas Derenthal avatar
    38 posts
    Member since:
    Apr 2010

    Posted 03 Nov 2014 in reply to Shinu Link to this post

    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();
           
        }
  8. Eyup
    Admin
    Eyup avatar
    3644 posts

    Posted 06 Nov 2014 Link to this post

    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.

     
  9. Thomas Derenthal
    Thomas Derenthal avatar
    38 posts
    Member since:
    Apr 2010

    Posted 14 Nov 2014 in reply to Eyup Link to this post

    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;
             }
    }
  10. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2406 posts

    Posted 19 Nov 2014 Link to this post

    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.

     
  11. Rahul
    Rahul avatar
    2 posts
    Member since:
    Sep 2018

    Posted 21 Sep 2018 in reply to Shinu Link to this post

    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 i 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 i select a single row on page1, and move on to any other page and now when i come back to page1 the row should persist its state.


    I would appreciate any help on this.

    Thanks, 

    Rahul..

  12. Eyup
    Admin
    Eyup avatar
    3644 posts

    Posted 26 Sep 2018 Link to this post

    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.
  13. Rahul
    Rahul avatar
    2 posts
    Member since:
    Sep 2018

    Posted 01 Oct 2018 in reply to Eyup Link to this post

    Thanks, Sir. It's Working.

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

  14. Eyup
    Admin
    Eyup avatar
    3644 posts

    Posted 03 Oct 2018 Link to this post

    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.
Back to Top