0

What might be the reason that this code does not work

There is DataList and inside asp:Menu with id Operator is located.

I use jQuery in order to get

$('#<%= DataList.ClientID %>').find('[id*=Operator]').each(function () {
                strEnd = strEnd + ' ' +$(this).attr('id');
            });
alert(strEnd);

Funny thing is that I can locate it when I use find('[id*=o]', why single letter works and multiple letters does not (I tried with quotas around Operator, does not work), I tried to use 'Op' and 'op' words instead of operator, does not work.

What I want to do, I want to get this menu object. Theoretically I should be able to do it by simple play with <%=Operator.ClientId%> however it is inside this DataList, therefore when I try to use it it throws an error, which says that object does not exist.

Strange thing is that when I use [id$=Operator], it selected the object.

Example:

<asp:DataList ID="DataList" runat="server">
  <table cellpadding="0" cellspacing="0">
    <tr >
      <td >
        <asp:Menu ID="Operator"  runat="server"></asp:Menu>
      </td>
    </tr>
 </table>
</asp:DataList>
Darqer
  • 2,847
  • 9
  • 45
  • 65

0 Answers0