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

How to get Value of Radgrid in NestviewTemplate ?

3 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
trunghieu
Top achievements
Rank 1
trunghieu asked on 07 Jul 2011, 06:38 PM
Hello,I have a problem,i want to get value of RadGrid2 but Radgrid2 in Radgrid1,i don't know how to get ID of radgrid with Button Click event
images : http://s1211.photobucket.com/albums/cc435/hieukenpro/?action=view&current=e.png
and this's my code
protected void Button1_Click(object sender, EventArgs e)
      {
          int count = 0;
          string sukien = "";
          string namhientai = "";           
          foreach (GridDataItem item in (How to get ID of RadGrid2 in this Event ?).SelectedItems)
          {
              foreach (GridColumn column in item.OwnerTableView.RenderColumns)
              {
                  if (count == 1 || count == 2)
                  {
                      if (count == 1)
                          sukien = item[column.UniqueName].Text.ToString();
                      if (count == 2)
                          namhientai = item[column.UniqueName].Text.ToString();
                  }
                  count++;
              }
          }
      }
Please Help Me

Thanks,
Trung Hiếu

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Jul 2011, 07:51 AM
hi,

foreach (GridNestedViewItem itemNV in RadGrid1.MasterTableView.GetItems(GridItemType.NestedView))
{
    // put your condition here if u don't want
    RadGrid RadGrid2 = (RadGrid)itemNV.FindControl("RadGrid2");
    foreach (GridItem item in RadGrid2.SelectedItems)
    {
        // your logic sholy come here
    }
}


Thanks,
Jayesh Goyani

0
trunghieu
Top achievements
Rank 1
answered on 08 Jul 2011, 09:09 PM
Thank you,can you help me ? now i have 10 rows in Radgrid i want when i expand frist row and then  i expand second row,frist row will close
Thanks,
Trung Hiếu
0
Mira
Telerik team
answered on 14 Jul 2011, 08:56 AM
Hello Trunghieu,

The provided information is not enough for us to determine what is causing the issue.
Could you please provide a little bit more details? What HierarchyLoadMode do you use? Do you execute some code on ItemCommand or on ItemDataBound when expanding/collapsing items?

Sending us a sample runnable project will be highly appreciated.

Kind regards,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
trunghieu
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
trunghieu
Top achievements
Rank 1
Mira
Telerik team
Share this question
or