1

I want to make a call to a function of vb.net class from javascript. I mean I would call something which doesnot have extention as .aspx but rather .vb only. Is is possible? how?

Thanks and regards, Tanmay.

1 Answer 1

3

If you add

<System.Web.Services.WebMethod()>

To your function signature then you can use PageMethods to call that function from JavaScript

<System.Web.Services.WebMethod()>_
Public Shared Function DisplayDate()
    Label1.Text = DateTime.Now()
End Function

So now add a ScriptManager to your page and in the ScriptManager do this

<script language="javascript" type="text/javascript">
function ShowDate()
{
    PageMethods.DisplayDate();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.