473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to change VBScript to VB code behind file

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>
Jul 19 '05 #1
18 5246
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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
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>

Jul 19 '05 #2
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" <zl*******@nospam.hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
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>


Jul 19 '05 #3
Cor
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
Jul 19 '05 #4

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
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>


Jul 19 '05 #5
"Sean" <ss****@yahoo.com> 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

Jul 19 '05 #6
Cor
Armin,
What does my code have to do with VB Script, it is VB.net 2003
Cor
Jul 19 '05 #7
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" <na**************@optusnet.com.au> wrote in message
news:eu**************@TK2MSFTNGP10.phx.gbl...

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
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>



Jul 19 '05 #8
"Cor" <no*@non.com> 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

Jul 19 '05 #9
Cor
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
Jul 19 '05 #10
"Armin Zingler" <az*******@freenet.de> schrieb
"Cor" <no*@non.com> 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


.... my reply, not replay... *g*
an answer to Sean, so I don't see your problem.

--
Armin

Jul 19 '05 #11
Hello,

"Cor" <no*@non.com> schrieb:
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.


???

He posted some VBScript code:

| <script language="VBScript">

No relation to VB .NET programming.

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Jul 19 '05 #12
"Cor" <no*@non.com> schrieb
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.


Neither I replied to your posting, nor I mentioned asp.net server.

Apart from that, he mentioned "code behind" and "server control". I don't
know these terms - probably because they are not VB.NET related?

If you have a problem with me, simply ignore me. Most people didn't have one
in the past.
--
Armin

Jul 19 '05 #13
Cor

Armin,
In contraire to that I love your discussions now I understand it better, you
saw what I wrote to the Hirc.
But for me it is strange that everything about the vb.net asp applications
or webservices is send away to other groups.
That while in my opinion total .Net is more or less the normal successor
from the VB6 IIS application (the webclass).
Cor
Jul 19 '05 #14
They are ASP.NET terms. This is not a VB.NET newsgroup, the title of the
group is "dotnet.general". Id say that ASP.NET falls into that category?
"Armin Zingler" <az*******@freenet.de> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
"Cor" <no*@non.com> schrieb Apart from that, he mentioned "code behind" and "server control". I don't
know these terms - probably because they are not VB.NET related? Armin

Jul 19 '05 #15
"Rick" <ri**@NOSPAM.computetosuit.com> schrieb
They are ASP.NET terms. This is not a VB.NET newsgroup, the title of
the group is "dotnet.general". Id say that ASP.NET falls into that
category?


"This" newsgroup? "This" newsgroup where I read it is dotnet.langauges.vb.
It's a crossposting. Look at the header. If it's a ASP.NET issue, the VB.NET
group should not be included.
--
Armin

Jul 19 '05 #16
furthermore, if you are this irritated by such a small thing, maybe you
should just use the newsgroups to get help for yourself, and not try to help
others.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uo**************@tk2msftngp13.phx.gbl...
"Rick" <ri**@NOSPAM.computetosuit.com> schrieb
They are ASP.NET terms. This is not a VB.NET newsgroup, the title of
the group is "dotnet.general". Id say that ASP.NET falls into that
category?
"This" newsgroup? "This" newsgroup where I read it is dotnet.langauges.vb.
It's a crossposting. Look at the header. If it's a ASP.NET issue, the

VB.NET group should not be included.
--
Armin

Jul 19 '05 #17
Hello,

"Rick" <ri**@NOSPAM.computetosuit.com> schrieb:
C#.NET


;-)

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Jul 19 '05 #18
oops, lol.....
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:eE*************@TK2MSFTNGP10.phx.gbl...
Hello,

"Rick" <ri**@NOSPAM.computetosuit.com> schrieb:
C#.NET


;-)

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet

Jul 19 '05 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sean | last post by:
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...
10
by: Jim Ciotuszynski | last post by:
Is there an equivalent to the "button.attributes.add("onBlur","JavaScript:return somfunction();") ? I thought that vbscrpt would also do the same but when I run my code with the vbscript my...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
5
by: Drum2001 | last post by:
I have a database that allows the user to input a department code and get all the employees within the department. The table is generated from another script that places the numeric code as a...
0
by: ismailc | last post by:
Good day, I need help. I have an application that uses aspx pages together with vbscript window for developer coding. Now the page has an <input type='file'> upload object. The problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.