I want to slideToggle a bulleted list in ASP.NET using jQuery when I click a button. The C# code behind will update the bulleted list by calling a web service and displaying the data.
Would I have to call the jQuery function from the C# code after the C# code has finished? Has anyone got an example to show?
Here is my code, which I will keep simple:
Page code:
<asp:BulletedList runat="server" id="resultsList">
</asp:BulletedList>
<asp:Button runat="server" Text="Search" id="searchBtn"
onclick="searchBtn_Click" />
C# code behind for button:
resultsList.Item.Add( "New Item");
//do other stuff to list
jQuery code on page:
$("#searchBtn").click(function () {
$("#resultsList").slideToggle('slow', function () {
//do something
});
});
Although it doesn’t work. Is it because i’m not calling the jQuery code from the C# code behind?
Try this solution