---
title: "Injecting table row inside repeater item"  
description: "Injecting table row inside repeater item"  
author: "marcel ethan"  
published: 2014-08-27  
updated: 2014-08-27  
canonical: https://www.mindstick.com/forum/2170/injecting-table-row-inside-repeater-item  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Injecting table row inside repeater item

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to inject inside repeaters [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios), the [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that the [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table) is generated in a [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when) location.

If you try this [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) example, you will see that the rown is generated under [label](https://www.mindstick.com/articles/12835/print-label-tracking-how-do-these-features-make-auspost-woocommerce-plugin-better) '2' as it should be generated under label '1'.

Why does it happen? And how to [fix](https://yourviews.mindstick.com/view/80763/donald-trump-ki-jeet-fix-hai) that?

```
protected void Page_Load(object sender, EventArgs e){    int [] array = {1,2,3,4,5};    rpt.DataSource = array;    rpt.DataBind();    }protected string _extraRowHtml;protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e){   if (e.Item.ItemType == ListItemType.Item ||          e.Item.ItemType == ListItemType.AlternatingItem)  {                 int tmp = ((int)e.Item.DataItem);       _extraRowHtml = tmp == 1 ? "<tr><td class=\"topicsRow\" colspan=\"100%\"> Topics </td></tr>" : string.Empty; ;                 }}<asp:Repeater ID="rpt" runat="server" onitemdatabound="rpt_ItemDataBound">    <HeaderTemplate>       <table  cellpadding="0px" cellspacing="0">                </HeaderTemplate>               <ItemTemplate>          <tr style="height:50px">                   <td>           <asp:HyperLink  ID="lnkTitle" runat="server" Text='<%# Container.DataItem%>'/>                      </td>                    </tr>       <%# _extraRowHtml %>      </ItemTemplate>         <FooterTempl    </table>  </FooterTemplate></asp:Repeater>
```

## Replies

### Reply by Sumit Kesarwani

Hi Marcel,

replace:

<%# _extraRowHtml %>

with

```
<%# GetExtraRow(Container.DataItem) %>then in your code behind implement:protected string GetExtraRow(object Data){    int tmp = (int)
Data:    return _tmp == 1 ?
       
"<tr><td class=\"topicsRow\"
colspan=\"100%\"> Topics </td></tr>" :         string.Empty;}
```

Then and get rid of the rpt_ItemDataBound function (and the onItemDataBound).


---

Original Source: https://www.mindstick.com/forum/2170/injecting-table-row-inside-repeater-item

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
