From: MWulfe on
I want to use javascript to do the equivalent to this Windows Form
code on an asp.net webpage using VB:

if x = 2 and y = 3 then
messagebox.show("This is a message")
end if

Many of the code I've found appears to be obsolete or includes lots of
other bells and whistles (adding an alert to a datagrid or a control
attribute), which I do not need and only find confusing. I'm using
Web Developer Express 2008.

Help would be appreciated! Thanks!
From: Alexey Smirnov on
On Apr 30, 1:56 am, MWulfe <mwu...(a)yahoo.com> wrote:
> I want to use javascript to do the equivalent to this Windows Form
> code on an asp.net webpage using VB:
>
> if x = 2 and y = 3 then
>         messagebox.show("This is a message")
> end if
>
> Many of the code I've found appears to be obsolete or includes lots of
> other bells and whistles (adding an alert to a datagrid or a control
> attribute), which I do not need and only find confusing.  I'm using
> Web Developer Express 2008.
>
> Help would be appreciated!  Thanks!

if (x==2 && y==3)
alert("message");
From: Andy B. on

"Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message
news:dee1feb1-764e-4470-90b1-28c9684ee860(a)o14g2000yqb.googlegroups.com...
On Apr 30, 1:56 am, MWulfe <mwu...(a)yahoo.com> wrote:
> I want to use javascript to do the equivalent to this Windows Form
> code on an asp.net webpage using VB:
>
> if x = 2 and y = 3 then
> messagebox.show("This is a message")
> end if
>
> Many of the code I've found appears to be obsolete or includes lots of
> other bells and whistles (adding an alert to a datagrid or a control
> attribute), which I do not need and only find confusing. I'm using
> Web Developer Express 2008.
>
> Help would be appreciated! Thanks!

if (x==2 && y==3)
alert("message");

How do you do that from the vb codebehind?


From: Mark Rae [MVP] on
"Andy B." <a_borka(a)sbcglobal.net> wrote in message
news:#g3EwhD6KHA.5464(a)TK2MSFTNGP05.phx.gbl...

> How do you do that from the VB codebehind?

Probably something like:

If x = 2 And y = 3 Then
ClientScriptManager.RegisterStartupScript(Me.GetType, "message",
"alert('This is a message');", True)
End If


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From: Alexey Smirnov on
On Apr 30, 9:40 am, "Andy B." <a_bo...(a)sbcglobal.net> wrote:
> "Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message
>
> news:dee1feb1-764e-4470-90b1-28c9684ee860(a)o14g2000yqb.googlegroups.com...
> On Apr 30, 1:56 am, MWulfe <mwu...(a)yahoo.com> wrote:
>
> > I want to use javascript to do the equivalent to this Windows Form
> > code on an asp.net webpage using VB:
>
> > if x = 2 and y = 3 then
> > messagebox.show("This is a message")
> > end if
>
> > Many of the code I've found appears to be obsolete or includes lots of
> > other bells and whistles (adding an alert to a datagrid or a control
> > attribute), which I do not need and only find confusing. I'm using
> > Web Developer Express 2008.
>
> > Help would be appreciated! Thanks!
>
> if (x==2 && y==3)
> alert("message");
>
> How do you do that from the vb codebehind?

Sure, it's inline javascript. I think, he didn't mention that it must
be from the codebehind.

In addition to example by Mark, this can be done using public
variables as

vb.net
-----------------
Protected Dim x As Integer = 2
Protected Dim y As Integer = 3
-----------------

aspx
-----------------
if (<%=x%>==2 && <%=y%>==3)
alert("message");
-----------------

I think it should work as expected.