Call method defined aspx.cs from Javascript?
-
Hello All, I want to call one method defined in aspx.cs file like filldropdownlist() and i want to call that method in javascript. Please let me know how it possible in Javascript. Thanks
Anish Patel
-
Hello All, I want to call one method defined in aspx.cs file like filldropdownlist() and i want to call that method in javascript. Please let me know how it possible in Javascript. Thanks
Anish Patel
No, what you are asking for is not possible. You can't call a server side method from Javascript, and even if you could the server side method doesn't have access to the current page. You can use AJAX to send a request from a Javascript to the server. The Javascript would then recieve the data sent from the server and put it in the select element. You can use ASP.NET UpdatePanel controls to define parts of the page to update. It uses AJAX to make call to make a postback of the page, and the page would return the parts of the page that would be updated.
Despite everything, the person most likely to be fooling you next is yourself.