Click to See Complete Forum and Search --> : Call Asp Sub Procedure in Javascript


shaoen01
12-16-2005, 01:16 AM
Hi,

Im not sure if it is possible to call an ASP sub procedure in javascript, but i know vice versa is possible. Thanks

Ubik
12-16-2005, 10:39 AM
What you are asking is not really possible without contacting the server again, because asp is server side, and javascript is client side.

What are you trying to accomplish?

I mean, you could just have the javascript load the asp page with the functions you want.

shaoen01
12-16-2005, 09:51 PM
Hi,

Thanks for your reply. Well, i am currently working on a user control (.ascx) file in Asp.net. What i want to do is to create an image list box using <div> tags to expand and collaspe whenever user clicks on the "more" or "close" link/button.

The above i have already settled it, the only problem i have now is to allow user to select image and display the selected image upon clicking. Which means i must have a postback to ensure that the selected image is updated and to display other images besides the selected image displayed, when user expand the <div> tags.

My user control is something like a dropdownlist, but instead of text able to display images. Currently, I am using server-side coding to generate the images. It is dynamic because it will create the number of <img> tags according to how many image files i have in the provided directory of folder.

What do you suggest i should do to go around this problem?

Ubik
12-19-2005, 10:04 AM
Seems like you have two options:

1. load all of the possible images, and just display the one selected, using javascript, and hidden divs or

2. Have an 'onChange load('imagespage.asp') which just loads page with the one image selected.

The pros and cons are:

1. The cons is that Load times will be really bad, and bandwidth will be wasted, depending on how many images you have. The pro is that you will not need to make a round-trip to the server once the image is selected.

2. The pro is that you will not waste any bandwidth, but you will be making a round trip to the server and reloading the page again with the new image.

You may be able to hack your way through some AJAX to get the best of both worlds, however.

Good Luck.

shaoen01
12-19-2005, 10:59 AM
Thanks for letting me the options available. I will find out more information about AJAX as well. :D