Programitically Find Rows Selected

3 posts, 0 answers
  1. Aron
    Aron avatar
    80 posts
    Member since:
    Dec 2005

    Posted 09 Sep 2008 Link to this post

    Hello,
    I have a grid like the second one on:
    http://demos.telerik.com/ASPNET/prometheus/Grid/Examples/Client/Selecting/DefaultCS.aspx

    Below my grid there is a button.
    I need to programatically find out which rows are selected.

    However

    GridClientSelectColumn does not have a attribute of "Checked" like a normal checkbox.

    like:

    foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
    {
    if ((dataItem.FindControl("ClientSelectColumn") as GridClientSelectColumn).Checked)
    // do something
    }

  2. Aron
    Aron avatar
    80 posts
    Member since:
    Dec 2005

    Posted 09 Sep 2008 Link to this post

    ok, found it

    foreach (GridDataItem dataItem in RadGrid1.MasterTableView.GetSelectedItems())
    {
    // do some thing here
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Sep 2008 Link to this post

    Hello Aron,

    You can also try out the following code to loop through the selected items.
    cs:
    protected void Button1_Click(object sender, EventArgs e) 
        { 
            foreach (GridDataItem dataitem in RadGrid1.SelectedItems) 
            { 
                string strTxt = dataitem["Category"].Text; 
            } 
        } 
     

    Princy.
Back to Top