How to get ClientIDs of all textboxes in all rows of a Repeater

In an asp.net 3.5 website I need to get the ClientIDs of all textboxes in all rows of a Repeater (''rptrEntry''). This needs to be done on the client side and then pass those ClientIDs to a third party spellchecker (Keyoti). The repeater has three asp textboxes per row.

I have a spellchecking button outside of the Repeater like this:

<input type="button" onclick="els = getContainedTextFields(document.getElementById('rptrEntry')); rapidSpell.dialog_spellCheck(true, els)"  value="Spell check" style="width: 90px; font-size: 12px" class="Button" />


I have tried many variations of the following function but cannot seem to get the ClientIDs which need to be passed to the spellchecker:

   function getContainedTextFields(element){
        var ids = [];
        var children = element.childNodes;
        for (var j=0; j < children.length; j++)
        {
            if (children[j].tagName == "TEXTAREA" || (children[j].tagName == "INPUT" && children[j].getAttribute('type').toLowerCase()=="text"))
            {
                ids[ids.length] = children[j].id;
            }
        }
        return ids;
    }

Any help with this would be gratefully received.
Al230762Asked:
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.

Rainer JeschorCommented:
Hi,
does it have to be pure JavaScript? Or is jQuery an option?

Thanks.
Rainer
Al230762Author Commented:
Hi Rainer and thanks for responding.

Yes, jQuery is definitely an option and one that we explored shortly after grappling with Javascript for a couple of days.  In fact, we now have a jQuery solution to the problem that relies on the addition of a CssClass to each of the textboxes in the Repeater. So simple with jQuery as is often the case:

function getContainedTextFields() {
         var ids = [];
         var numberofboxestocheck = $('.cssRptrTB').length;
            for (i = 0; i < numberofboxestocheck; i++) {
             var txbID = $('.cssRptrTB').eq(i).attr('ID');
             ids[ids.length] = txbID;
            }
            return ids;
     }



  <input type="button" id='dialogBT' onclick="els = getContainedTextFields(); rapidSpell.dialog_spellCheck(true, els)"
                                                        value="Spell check" style="width: 90px; font-size: 12px" class="Button" />

<asp:Repeater ID="rptrLevels" runat="server">
  <ItemTemplate>
<tr style="vertical-align: top" id="rptrDataRow">
 <td>
 <asp:TextBox ID="txtEntry" runat="server" Font-Size="11px" Height="60px"
   Text='<%# Container.DataItem("EntryLev")%>' TextMode="MultiLine" ToolTip="255 characters limit"
   Width="140px" CssClass="cssRptrTB"></asp:TextBox>
</td>


  <td>
 <asp:TextBox ID="txtTarget" runat="server" Font-Size="11px" Height="60px"
   Text='<%# Container.DataItem("EntryLev")%>' TextMode="MultiLine" ToolTip="255 characters limit"
   Width="140px" CssClass="cssRptrTB"></asp:TextBox>
</td>
  </tr>
 </ItemTemplate>
</asp:Repeater>

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
Al230762Author Commented:
After a couple of days grappling with JavaScript and shortly after posting our question on EE, we decided to try a solution based on jQuery which provided the answer for us. The comment from Rainer has been marked as 'Helpful'
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
ASP.NET

From novice to tech pro — start learning today.