So with the help of @lucidgold, finally it is now working! The solution is to call the javascript function on the button server side. After tweaking around, here's the complete solution:
- I remove return true on the JavaScript function
Remove the useSubmitBehaviour property on the button:
<asp:Button ID="TestButton" Text="Test Me" OnClick="TestButton_Click" runat="server"/>
Run RegisterStartupScript in C# as follows:
ClientScript.RegisterStartupScript(GetType(), "script", "<script type ='text/javascript'> getListOfPOI(); </script>");