htmlajaxtriggersupdatepanelserver-error

A control with ID "" could not be found for the trigger in UpdatePanel ""


I'm trying to use an update panel so my page doesn't refresh every time I make a click in a menu item but it seems that what i'm doing is not working out would u help me out?

by the way this code is part of a sub-menu list, so i'm not able to change it for a button or something like that. this is my code:

<ul id="ebul_mb73g0_2" class="ebul_mb73g0" style="display: none;">
   <li>            
     **<asp:UpdatePanel runat="server" id="UpdatePanel2" updatemode="Conditional">
           <ContentTemplate>
              <a title="" id="btnStock" tabindex="2" onclick="btnStock_Click">Stock</a>    
           </ContentTemplate>
           <Triggers>
              <asp:AsyncPostBackTrigger ControlID="btnStock" eventname="Click" />
           </Triggers>            
      </asp:UpdatePanel>**
   </li>             
   <li><a title="" id="btnSales" tabindex="3">Sales</a></li>
</ul>

and here is the execution error i get: A control with ID 'btnStock' could not be found for the trigger in UpdatePanel 'UpdatePanel2'

i believe it's because <a></a> is not a control, but is there any way i could make that work out?

thank you for the help =)


Solution

  • You're right, the <a> is not a server side control.

    I think you want to change to an <asp:Button> for this since it's not really a link if you want to cause a postback and hit btnStock_Click().