Get Items from RadGrid on ButtonClick

4 posts, 0 answers
  1. Erik
    Erik avatar
    22 posts
    Member since:
    Apr 2009

    Posted 23 Feb 2010 Link to this post

    I want to collect all Items in a RadGrid form a function triggerd by a Button!

    protected void lbtnChooseOffer_Click(object sender, EventArgs e) 
        foreach (var item in RadGridMembers.Items) 
        { 
        } 

    But when i use this, all that item contains is an Id. How do i get all items from a RadGrid when i push a button?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2010 Link to this post

    Hi,

    Please have a  look at the following link below on accessing cells and rows. You can access the cell values using the Column UniqueName 

    C#
    protected void Button1_Click(object sender, EventArgs e) 
        { 
            foreach (GridDataItem dataItem in RadGrid1.Items) 
            { 
              string txt =  dataItem["ColumnUniqueName"].Text; 
            } 
       }  


    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Erik
    Erik avatar
    22 posts
    Member since:
    Apr 2009

    Posted 23 Feb 2010 Link to this post

    Thank that, works in 50% of the cases!

    myMember.Sex = Convert.ToInt32((dataItem.FindControlR("rcbSex") as RadComboBox).SelectedValue);

    (dataItem.FindControlR("rcbSex") as RadComboBox returns null everytime, how do I find this Control?

  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2010 Link to this post

    Hi,

    Please try accessing using the UniqueName as  shown below

    myMember.Sex = Convert.ToInt32((dataItem["ColumnUniqueName"].FindControlR("rcbSex") as RadComboBox).SelectedValue);

    Thanks,
    Princy
Back to Top