By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,062 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

accessing asp .net function

P: n/a
for simplicity sake, i have this servers-side code:

<script language="VB" runat="server">
Sub Clear()
txtMessage.Value = ""
Calendar1.SelectedDates.Clear()
End Sub
</script>

i also have a regular html button tag.
<input type="button" value="OK" id="b1" onclick="Clear;">

is there a way i can access the server-side asp. net
function Clear() by clicking the button?
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You need a runat="server" on that button, so it does a postback to the
server to do the clear. Also, I think you need to remove the ';' after the
Clear.

Right now it is trying to do this on the client - and you can't access
server side functions from the client.
"Mr. Roboto" <ay****@yahoo.com> wrote in message
news:01****************************@phx.gbl...
for simplicity sake, i have this servers-side code:

<script language="VB" runat="server">
Sub Clear()
txtMessage.Value = ""
Calendar1.SelectedDates.Clear()
End Sub
</script>

i also have a regular html button tag.
<input type="button" value="OK" id="b1" onclick="Clear;">

is there a way i can access the server-side asp. net
function Clear() by clicking the button?

Jul 19 '05 #2

P: n/a
Hi!

No, thats not possible since server side code can be accessed "only" by
server side code. Click event at the client side cannot do so, and will need
to simulate a postback that will transfer control to the server and the
server code can then access the method.

--

Regards,
Gaurav Khanna
----------------------------------------------------------------------------
----------------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/

"Mr. Roboto" <ay****@yahoo.com> wrote in message
news:01****************************@phx.gbl...
for simplicity sake, i have this servers-side code:

<script language="VB" runat="server">
Sub Clear()
txtMessage.Value = ""
Calendar1.SelectedDates.Clear()
End Sub
</script>

i also have a regular html button tag.
<input type="button" value="OK" id="b1" onclick="Clear;">

is there a way i can access the server-side asp. net
function Clear() by clicking the button?

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.