WebForm class functions in JavaScript

  • Thread starter Thread starter jurot
  • Start date Start date
J

jurot

Hi,

Can anybody advice me please,how can I use my WebForm members (defined
in codebehind, e.g. index.aspx.cs) in JavaScript script in
index.aspx.

For example:


public class WebForm1 : System.Web.UI.Page
{
public void XY()
{
...
}
}

[index.aspx]
...
<script language="JavaScript">

function CallingXY()
{
//HERE I WANT TO CALL WebForm1.XY()
}

</script>

...

And also how can I use JavaScript functions in codebehind
(index.aspx.cs)?

Thank you very much.
 
Think of your ASP.Net Pages as 2 distinct entities: the server-side and the
client-side. These are actually 2 quite different entities, and they are
like prisoners in a prison separated by a wall with a small slot in it, big
enough to pass text notes (QueryString, Form elements, Cookies) through.
That is all that they can do. They do not share memory space, or even the
same technology. The server merely writes HTML text (and other files) out to
the browser. The browser sends text back to the server. End of story.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

jurot said:
Hi,

Can anybody advice me please,how can I use my WebForm members (defined
in codebehind, e.g. index.aspx.cs) in JavaScript script in
index.aspx.

For example:


public class WebForm1 : System.Web.UI.Page
{
public void XY()
{
...
}
}

[index.aspx]
..
<script language="JavaScript">

function CallingXY()
{
//HERE I WANT TO CALL WebForm1.XY()
}

</script>

..

And also how can I use JavaScript functions in codebehind
(index.aspx.cs)?

Thank you very much.
 
Back
Top