Professional Web Applications Themes

Newbie... executing code when a button is clicked... - ASP Database

Hello there... I am completely new to ASP and web programming. We have a small project going on and somehow I am getting involved. I use Access and VB so have programming experience. To learn a bit about ASP, I downloaded a product which auto generated a bunch of ASP pages for me which opens an access db using ODBC and allows additions/changes and deletions. It came out pretty basic but not bad... Now, I want to edit some of the ASP and add some more buttons and also add some edit checking on some existing forms... I am used ...

  1. #1

    Default Newbie... executing code when a button is clicked...

    Hello there...

    I am completely new to ASP and web programming. We have a small project
    going on and somehow I am getting involved. I use Access and VB so have
    programming experience.

    To learn a bit about ASP, I downloaded a product which auto generated a
    bunch of ASP pages for me which opens an access db using ODBC and allows
    additions/changes and deletions. It came out pretty basic but not bad...
    Now, I want to edit some of the ASP and add some more buttons and also add
    some edit checking on some existing forms...

    I am used to placing code on events in VB and Access to provide this type of
    thing... We do not have an ASP product installed so I cannot create forms
    etc... (I;m assuming you can do this with an ASP.net etc...)

    We do however have Visual Studio .NET and I was able to open one of the ASP
    pages that were pre-generated for editing...

    Since there is no "form" per se - as compared to what I am used to (it's all
    text in the ASP page) , where do I place code that I want to run when a
    user clicks a button or enters data in a particular field?

    For instance, as a test, I located a line defining buttons in one particular
    ASP page. I then duplicated that line and changed some things and when I ran
    the project - low and behold, there was my new button.

    Now my question is, I want to have something happen when that button is
    clicked - something real simple - like display the user a message that
    "button was clicked".

    Here is a button definition line I added...

    input class=button type=button value="Test" ID="Test1" NAME="Test1"

    How do I reference this in the code somewhere so that when it is clicked,
    the code to display a message will run? Can someone give me some sample
    code and point out how it all works?


    Thanks,

    Brad


    Brad Guest

  2. #2

    Default Re: Newbie... executing code when a button is clicked...

    <HTML><BODY>

    <form>
    <input type=button value="Test" ID="Test1" NAME="Test1"
    onclick="javascript:alert('Hi world')">
    </form>

    </BODY></HTML>

    "Brad Pears" <com> wrote in message
    news:OFgRpP$phx.gbl... 
    of 
    ASP 
    all 
    particular 
    ran 


    Raymond Guest

  3. #3

    Default Re: Newbie... executing code when a button is clicked...

    Brad Pears wrote: 

    ASP is server-side code. This means it executes on the web server, and
    generates the html to be sent to the client browser. You wish an action to
    take place when the user does something. That puts you into client-side
    code, which is off-topic for this newsgroup. You should post further
    questions about client-side code to one of the "dhtml" groups, or one of the
    "scripting" groups, probably the jscript one.

    I would suggest that you go to http://msdn.microsoft.com/library and drill
    down in the Web Development node in the TOC until you get to the section on
    HTML and Dynamic HTML. Look up events, particularly the onclick event. in
    the meantime, try this:

    <input class=button type=button value="Test" ID="Test1" NAME="Test1"
    onclick="alert('You clicked me!')">


    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Guest

  4. #4

    Default Re: Newbie... executing code when a button is clicked...

    Stop using ODBC/DSN. Please read the following links for more info.

    http://www.aspfaq.com/show.asp?id=2126

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/ado_deprecated_components.asp

    Brad Pears wrote: 

    Joker Guest

Similar Threads

  1. Adding a second button if the first button is clicked
    By Dave Prout in forum ASP.NET Building Controls
    Replies: 1
    Last Post: June 8th, 09:15 PM
  2. Which action button clicked?
    By perl@swanmail.com in forum PERL Beginners
    Replies: 3
    Last Post: October 14th, 10:38 PM
  3. Replies: 1
    Last Post: September 4th, 07:08 AM
  4. Which button column was clicked.
    By Jim Mitchell in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: July 4th, 02:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139