repeater and jquery

Hi,

Is it possible to put text in repeater using jquery? I have given repeater code and highlighted the area where I need jquery function to display.

Repeater


<asp:Repeater ID="rptProducts" runat="server">
    <HeaderTemplate>
        <asp:Label ID="lblHeader" runat="server" Font-Bold = "true" /><br />
    </HeaderTemplate>
    <ItemTemplate>
-----------      I have to put something using jquery ---
        <%#Eval("Name") %> - <%#Eval("Price") %><br />

    </ItemTemplate>
    <FooterTemplate>
        <asp:Label ID="lblFooter" runat="server" Font-Bold = "true" />
    </FooterTemplate>
</asp:Repeater>

Open in new window


Please guide, if it is possible? And, how to write jquery? You can give me any example.

Thanks
Johny12345Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Is the text the same?
Add an element in your repeater where you want the text to go - give it a class to identify it.
(see inserted <span> below)
<asp:Repeater ID="rptProducts" runat="server">
    <HeaderTemplate>
        <asp:Label ID="lblHeader" runat="server" Font-Bold = "true" /><br />
    </HeaderTemplate>
    <ItemTemplate>
         <span class="mytext"></span> <!-- ADD THIS -->
        <%#Eval("Name") %> - <%#Eval("Price") %><br />

    </ItemTemplate>
    <FooterTemplate>
        <asp:Label ID="lblFooter" runat="server" Font-Bold = "true" />
    </FooterTemplate>
</asp:Repeater>

Open in new window

Use the following JQuery to target the generated <span> elements and populate them with the required text
<script type="text/javascript">
$(function() {
   $('span.mytext').html('My custom string here');
});
</script>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Johny12345Author Commented:
Great, thanks sir
Julian HansenCommented:
You are most welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.