PC Review


Reply
Thread Tools Rate Thread

How to change VBScript to VB code behind file

 
 
Sean
Guest
Posts: n/a
 
      13th Aug 2003
Hi,

I need a pop-up window for user to confirm change. The default button is the
second option (No). As the user only use IE, I think the VBScript is an
option. The following code only works for html button. I wonder how I can
change it to VB code behind file and use a server control.

Thanks.

<script language="VBScript">
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
vbCritical+ vbDefaultButton2, "Title")

If vbResponse = vbYes Then
' do something
Else
' Label1.Text = "do not do delete"
End If
End Sub
</script>


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      13th Aug 2003
The only way to do that, is if you controls outputs the javascript you have
there.

VBScript and VB.NET code behind - are not related in any way. The former is
a client side scripting language, while the latter is a server side compiled
language. No relation.

Your VB.NET would have to generated this VBScript code, for it to run.

"Sean" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I need a pop-up window for user to confirm change. The default button is

the
> second option (No). As the user only use IE, I think the VBScript is an
> option. The following code only works for html button. I wonder how I can
> change it to VB code behind file and use a server control.
>
> Thanks.
>
> <script language="VBScript">
> Sub cmdDelete()
> Dim vbResponse
> vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
> vbCritical+ vbDefaultButton2, "Title")
>
> If vbResponse = vbYes Then
> ' do something
> Else
> ' Label1.Text = "do not do delete"
> End If
> End Sub
> </script>
>
>



 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      13th Aug 2003
Marina,

Thanks for your reply.

If I am correct, javascript doesn't allow me to set the default button to
the 2nd option (e.g. No.). If VBScript doesn't work here, in this case, what
option do I have for implementation?

Thanks for your input.



"Marina" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The only way to do that, is if you controls outputs the javascript you

have
> there.
>
> VBScript and VB.NET code behind - are not related in any way. The former

is
> a client side scripting language, while the latter is a server side

compiled
> language. No relation.
>
> Your VB.NET would have to generated this VBScript code, for it to run.
>
> "Sean" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I need a pop-up window for user to confirm change. The default button is

> the
> > second option (No). As the user only use IE, I think the VBScript is an
> > option. The following code only works for html button. I wonder how I

can
> > change it to VB code behind file and use a server control.
> >
> > Thanks.
> >
> > <script language="VBScript">
> > Sub cmdDelete()
> > Dim vbResponse
> > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
> > vbCritical+ vbDefaultButton2, "Title")
> >
> > If vbResponse = vbYes Then
> > ' do something
> > Else
> > ' Label1.Text = "do not do delete"
> > End If
> > End Sub
> > </script>
> >
> >

>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      13th Aug 2003
Hi Sean,
I used for this example a webform with one textbox and two buttons on it
(named Buttonyes and ButtonNo.)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = "are you sure you want to delete?"
End Sub

Private Sub ButtonNo_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ButtonNo.Click
TextBox1.Text = "do something"
End Sub

Private Sub Buttonyes_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Buttonyes.Click
TextBox1.Text = "do not delete"
End Sub
See yourself how it works
Cor


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      13th Aug 2003
"Sean" <(E-Mail Removed)> schrieb
> I need a pop-up window for user to confirm change. The default button
> is the second option (No). As the user only use IE, I think the
> VBScript is an option. The following code only works for html button.
> I wonder how I can change it to VB code behind file and use a server
> control.


I don't know VBScript. Please don't post to a VB.NET group. Thanks.


--
Armin

 
Reply With Quote
 
James Zhuo
Guest
Posts: n/a
 
      13th Aug 2003

"Marina" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The only way to do that, is if you controls outputs the javascript you

have
> there.
>
> VBScript and VB.NET code behind - are not related in any way. The former

is
> a client side scripting language, while the latter is a server side

compiled
> language. No relation.


Well, VBScript is used for ASP, so it's not necessarily used on the client
side.

I think you can reuse that code, only that you have to bind it to the
control/button
that you want to use.


>
> Your VB.NET would have to generated this VBScript code, for it to run.
>
> "Sean" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I need a pop-up window for user to confirm change. The default button is

> the
> > second option (No). As the user only use IE, I think the VBScript is an
> > option. The following code only works for html button. I wonder how I

can
> > change it to VB code behind file and use a server control.
> >
> > Thanks.
> >
> > <script language="VBScript">
> > Sub cmdDelete()
> > Dim vbResponse
> > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
> > vbCritical+ vbDefaultButton2, "Title")
> >
> > If vbResponse = vbYes Then
> > ' do something
> > Else
> > ' Label1.Text = "do not do delete"
> > End If
> > End Sub
> > </script>
> >
> >

>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      13th Aug 2003
Armin,
What does my code have to do with VB Script, it is VB.net 2003
Cor


 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      13th Aug 2003
How can I bind it to a control/button, then?
I tried Button1.Attributes.Add("onclick", "VBscriptFunctionName();") in
Page_Load, but it is not working either.

Thanks.

"James Zhuo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Marina" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > The only way to do that, is if you controls outputs the javascript you

> have
> > there.
> >
> > VBScript and VB.NET code behind - are not related in any way. The

former
> is
> > a client side scripting language, while the latter is a server side

> compiled
> > language. No relation.

>
> Well, VBScript is used for ASP, so it's not necessarily used on the client
> side.
>
> I think you can reuse that code, only that you have to bind it to the
> control/button
> that you want to use.
>
>
> >
> > Your VB.NET would have to generated this VBScript code, for it to run.
> >
> > "Sean" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi,
> > >
> > > I need a pop-up window for user to confirm change. The default button

is
> > the
> > > second option (No). As the user only use IE, I think the VBScript is

an
> > > option. The following code only works for html button. I wonder how I

> can
> > > change it to VB code behind file and use a server control.
> > >
> > > Thanks.
> > >
> > > <script language="VBScript">
> > > Sub cmdDelete()
> > > Dim vbResponse
> > > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
> > > vbCritical+ vbDefaultButton2, "Title")
> > >
> > > If vbResponse = vbYes Then
> > > ' do something
> > > Else
> > > ' Label1.Text = "do not do delete"
> > > End If
> > > End Sub
> > > </script>
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      13th Aug 2003
"Cor" <(E-Mail Removed)> schrieb
> Armin,
> What does my code have to do with VB Script, it is VB.net 2003
> Cor


I did not read your code. I replied to Sean and my replay shows up as an
answer to Sean, so I don't see your problem.


--
Armin

 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      13th Aug 2003
Armin,
His qeustion was how he could use VB code behind, that you make with a
VB.net Asp.Net webapplication.
The asp.net server has slightly to do with that.
Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Change public VBA variable from form VBScript code Sue Mosher [MVP-Outlook] Microsoft Outlook VBA Programming 0 20th Dec 2006 01:15 PM
Re: Change public VBA variable from form VBScript code Sue Mosher [MVP-Outlook] Microsoft Outlook Form Programming 0 20th Dec 2006 01:14 PM
How to change VBScript to VB code behind file Sean Microsoft Dot NET 18 14th Aug 2003 02:48 PM
How to change VBScript to VB code behind file Sean Microsoft ASP .NET 5 13th Aug 2003 05:29 PM
Re: how to use vbscript in .net code behind file S. Justin Gengo Microsoft ASP .NET 0 17th Jul 2003 05:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:15 AM.