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

Footer row not re-binding

3 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ian webster
Top achievements
Rank 1
ian webster asked on 17 Feb 2009, 08:26 AM
Hi,

I have a rad grid with a number of templated columns for example...

<telerik:GridTemplateColumn UniqueName="PremiumPartName" HeaderText="Premium Part">
 
<ItemTemplate>
    <asp:HiddenField ID="hdnPremiumPartID" runat="server" />
    <asp:HiddenField ID="hdnOriginalITP" runat="server" />
    <asp:HiddenField ID="hdnOriginalGross" runat="server" />
    <asp:Literal ID="litPremiumPart" runat="server" />
   </ItemTemplate>
   <FooterTemplate>
     <asp:Literal ID="litTotalLabel" runat="server" />
  
</FooterTemplate>
</telerik:GridTemplateColumn>

I'm binding the values using the item data bound event...

 

 

protected void grdAdjustments_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
  switch
(e.Item.ItemType)
  {
    case Telerik.Web.UI.GridItemType
.AlternatingItem:
    case Telerik.Web.UI.GridItemType
.Item:
        //ItemIndexHierarchical
       
if (e.Item.ItemIndexHierarchical.Split(':'
).Length > 1)
        {
           //details table
           BindDetailTableRow(e);
        }
        else
        {
           //master table row
          BindMasterTableRow(e);
        }

 

 

        break;
   case Telerik.Web.UI.GridItemType
.NestedView:

 

 

        break;

 

 

   case Telerik.Web.UI.GridItemType.Footer:
        //bind footer

 

 

        BindFooterRow(e);
      

break;

 

    }

}

 

This works fine when the grid is first bound, however when I try to expand a details table for one of the rows the footer is blank. Any ideas why this might be?

Thanks

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 17 Feb 2009, 02:23 PM
Hello ian,

I suspect the ItemDataBound event handler is not raised. Another option in this case which you can try is to use the PreRender event handler, and iterate through the hierarchy, and the TableView objects, to get a reference to the footer, and populate it as needed.
I hope this suggestion helps.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
ian webster
Top achievements
Rank 1
answered on 17 Feb 2009, 04:07 PM
Hi Yavor,

Thanks for your response, I've stepped through the binding and I think you are right, it looks like once you expand a details table only the details table gets item data bound events fired, the master table is not bound again. What confuses me though is that the rows in the master table are not lost, surely if they are not being rebound the same thing would happen to them as the footer?

Anyway I shall try your pre render suggestion thanks.
0
Yavor
Telerik team
answered on 18 Feb 2009, 08:11 AM
Hi ian,

Basically, using the ItemDataBound handler to cater for such custom logic is not a very good approach, because, for optimization purposes, the control does not rebind on each page load, and hence this may cause problems. Therefore, you can use another event, such as the PreRender handler, since it is always raised, to achieve the desired functionality. I hope this setup meets your requirements well.

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
ian webster
Top achievements
Rank 1
Answers by
Yavor
Telerik team
ian webster
Top achievements
Rank 1
Share this question
or