Sajid Hussain
Sajid Hussain

Reputation: 63

how to add a row in repeater using jquery

how to add a row in repeater using jquery

my code is

<asp:Repeater runat="server" ID="repChiefComplaint"  >
            <ItemTemplate>
                <tr>
                    <td class="frm_field_label_left">
                        <asp:LinkButton ID="lbGuarentor1" runat="server" Text='' OnClientClick="return false;"></cube:LinkButton>
                    </td>
                    <td><asp:ImageButton ID="imgDelete1" runat="server" CommandName="delete" CommandArgument='' SkinID="Delete" /></td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>

Upvotes: 0

Views: 3111

Answers (2)

Satpal
Satpal

Reputation: 133403

i want to add an Item in repeater

As per comment

You wont be able to add anything to ItemTemplate using jQuery as repeater control is rendered using ASP.NET engine where as jQuery executes on client side.

You can add row <tr></tr> using jQuery.

Upvotes: 1

Andrei Zhamoida
Andrei Zhamoida

Reputation: 1464

Try to use CSS selector syntax. It works if repeaters id begins from rep

var tr = '<ItemTemplate>
              <td class="frm_field_label_left">
                  <asp:LinkButton ID="lbGuarentor1" runat="server" Text="" OnClientClick="return false;"></cube:LinkButton>
              </td>
              <td>
                  <asp:ImageButton ID="imgDelete1" runat="server" CommandName="delete" CommandArgument='' SkinID="Delete" />
              </td>
         </ItemTemplate>';   

$('[id*=rep]').append(tr)

Upvotes: 0

Related Questions