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

Expanding DetailTable clears bound items on Master

2 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carl
Top achievements
Rank 1
Carl asked on 24 Apr 2012, 12:15 PM
Hi

I have a problem I can't seem to work out.

Basically I have a MasterTableView / DetailTable relationship. In the master table I am changing the checkbox to an image at the ItemDataBound event - this works fine.

However, when I expand the DetailView the images are removed and the checkboxes re-appear (coincidentially they are always unchecked).

Does anyone know how I should handle this situation so that when the details view is expanded the tick box images remain in the parent MasterTableView?

Many thanks
Carl
protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)
      {
          if (e.Item is GridDataItem)
          {
              GridDataItem item = (GridDataItem)e.Item;
           
              var row = item.DataItem as Reporting.EntityModel.Stock;
 
              if (row != null)
              {
                  item["Active"].Controls.Clear();
 
                  if (row.Active == true)
                  {
                      item["Active"].Controls.Add(new Image() { ImageUrl = "/Assets/Images/tick_small_col.png" });
                  }
                  else
                  {
                      item["Active"].Controls.Add(new Image() { ImageUrl = "/Assets/Images/cross_small_col.png" });
                  }
 
                  
              }
              
 
          }
 
      }

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 26 Apr 2012, 07:56 PM
Carl:

I'd suggest checking your GridTableView.HierarchyLoadMode setting to make sure your not causing a rebind when expanding the detail view. If rebinding, and you’re modifications are not stored in state, the RadGrid may be reverting to the checkbox properties specified in the .aspx markup, therby losing your image assignments, unless they are persisted using state.

See the Hierarchy Lode Mode documentation page for details on this.

I hope this helps.
0
Carl
Top achievements
Rank 1
answered on 27 Apr 2012, 03:20 PM
Thanks for the help, I investingated the HierarchyLoadMode and the client load worked fine, however was a bit intensive on the database. To make my life simple I ended up using jQuery to replace the tick boxes with an image (remebering to use the PageLoad function) - this worked well.
Thanks
Carl
Tags
Grid
Asked by
Carl
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Carl
Top achievements
Rank 1
Share this question
or