I have an ASP.NET application with a button that executes VB.NET on the server when clicked.
Specs have changed, I've added a menu of sorts which is to replace the VB button. With some help from S.O., I've managed to manipulate some javascript which does a postback and executes the button's code. I figured I could just make the button invisible and still be able to call it's on_click event from js. How wrong I was!
So now, somehow I'm supposed to call a VB sub from either javascript or (boss says) ajax. I have no idea how to do this.
Could anyone give me a good direction as to how I can call a VB.NET subroutine from ajax on the client? Or javascript?
Thanks in advance, Jason
It's not obvious that you could just switch to Ajax from a postback scenario, whatever your boss tells you. :-) Lots of stuff might happen in a postback that you don't do in an Ajax call; setting other values serverside, changing visibility and such. It's hard to tell without seeing the actual code, though.
The easiest way for you now would be to be able to "click" that button again. The problem is how you set the invisibility, some types of invisibility makes the button disappear from the form, leaving it impossible to press it even programmatically.
Again, without seeing the code it's hard to tell which way you should go, but to hide it with css will make it possible to "click" it the way you have done. Hiding it with "button.Visible = false" server side won't.