Toggle Individual Row with check box

3 posts, 0 answers
  1. Jack Voss
    Jack Voss avatar
    27 posts
    Member since:
    May 2010

    Posted 04 Apr 2012 Link to this post

    I looked at the grid demo here

    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx

    Unfortunately it references "ToggleRowSelection" in the ASP page for the row on CheckedChange.
    When you look at the code demo, ToggleRowSelection does not exist. 

    The code for when you select the header does indeed exist.

    protected void ToggleSelectedState(object sender, EventArgs e)
            {
                CheckBox headerCheckBox = (sender as CheckBox);
                foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
                {
                    (dataItem.FindControl("CheckBox1") as CheckBox).Checked = headerCheckBox.Checked;
                    dataItem.Selected = headerCheckBox.Checked;
                }
            }


    So what I am trying to find out,  what is the code for checking that individual row?

    What should be in ToggleRowSelection
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Apr 2012 Link to this post

    Hi,

    I have tried the same code as in the demo and is working fine at my end. Please take a look into the following code.

    C#:
    protected void ToggleRowSelection(object sender, EventArgs e)
    {
        ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jack Voss
    Jack Voss avatar
    27 posts
    Member since:
    May 2010

    Posted 04 Apr 2012 Link to this post

    Apparantly I am just blind.

    Thank you.
Back to Top