Calling a server side function

I have a button, On the click event I want to call a server side vb proceedure

my client side code:
<input type=button onclick=<%abc()%>>

Server side code:
<SCRIPT LANGUAGE=vbscript>
  function abc()
      response.write "dfgsdgdf"      
  end function
</script>


can somebody tell me waht's the problem.


thanx in advance
anilkumarvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hcyuCommented:
I think after the asp loaded from the server, all the server side tag and function will transform to be ordinary HTML code, and the page can't see any server side code. Therefore, you can't click a button to call a server side function.

What you can do is just clicking the button to call a client-side javascript function to do so. e.g.



<html>
<head>
<script language="javascript">
<!--
function showing(){
  window.alert("aaaaa");
}
//-->
</script>
</head>

<body>
<form>
<input type=button onclick="javascript:showing();">
</form>

</body>
</html>

0
JOKCommented:
I think you can call a vbs function, but it will only work in IE.
0
pietjepukCommented:
If all this code is together in the same script, hcyu is right. You can execute server side script while loading the page. Once you have loaded it you are on the client side. If you want to execute server side script after pressing a button you have to load a new asp page or reload the current page.

But is this what you want? If you just want a message to popup when you click the button you can use client side VBscript. Use something like:

<input type=button onclick=abc()>

<SCRIPT LANGUAGE = VBscript>
  Sub abc()
      msgbox "dfgsdgdf"
  End Sub
</SCRIPT>





0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

anilkumarvAuthor Commented:
hcyu,
Thanx for your comment.But I want to write my functionality in server side whenever user clicks the button.
0
JOKCommented:
Won't be allow to call a server side without reloading the page or calling another page. If its server side, it means having to make another trip to the server.

What type of functionality are you trying to write?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JOKCommented:
Won't be allow to call a server side without reloading the page or calling another page. If its server side, it means having to make another trip to the server.

What type of functionality are you trying to write?
0
TTomCommented:
Not quite true.

There is also a "remote scripting" capability in ASP which allows client side actions to generate server side effects (i.e., clicking a button on the client side causes the server to execute a routine and send new data to the client).

This seems to be what you want to do, and it has received some discussion on VI6talk@listbot.com in the past few days.

Unfortunately, I am not an expert on its use, so I only point you in that direction.

Tom
0
JOKCommented:
Yeah, haven't tried it before, so I keep forgetting about it. Try also going to www.asptoday.com and searching for "remote scripting" there's a couple of articles there.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.