Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2003

Tip: Looking for answers? Try searching our database.

How to change VBScript to VB code behind file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean - 13 Aug 2003 15:20 GMT
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
Marina - 13 Aug 2003 15:25 GMT
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.

> Hi,
>
[quoted text clipped - 18 lines]
>   End Sub
> </script
Sean - 13 Aug 2003 16:02 GMT
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.

> The only way to do that, is if you controls outputs the javascript you have
> there.
[quoted text clipped - 28 lines]
> >   End Sub
> > </script
James Zhuo - 13 Aug 2003 16:51 GMT
> 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.
>
[quoted text clipped - 21 lines]
> >   End Sub
> > </script
Sean - 13 Aug 2003 17:29 GMT
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.

> > The only way to do that, is if you controls outputs the javascript you
> have
[quoted text clipped - 39 lines]
> > >   End Sub
> > > </script
Cor - 13 Aug 2003 16:36 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.