Solved

ASP for JAVA script or VB script...

Posted on 2007-04-06
12
362 Views
Last Modified: 2008-02-01
Hello,
       A little history about me real quick..  I have several years of VB 5.0 and v6.0 expereince.  I took a break from coding for awhile and took a job as a Oracle DBA. I was only creating PL/SQL scripts It was ok, but after 4 years I came back to development again.  2 weeks ago, I just started a new job.   The job has a ton of Access 2003 DB's they want converted to SQL Server with .NET frontend.   Some of the DB's will nned to have a web frontend also so users use input their data into the db from the web.
      Ok...  sorry for the long winded background on me and this job, just trying to give a little background and let you all know I am not fresh out of college.
      The developer before me created a webpage one of the DB's.   The page was not connecting to a DB, it was creating a text(Comma delimited),the text file would then get ftp'd to the server where the Access DB lived, the text file would get uploaded uploaded to the DB everyday.   Don't asked me why they did this, it had to do with government security issue, etc...   So I have been reviewing the last developers code, in the page.   He used Frontpage to create it.   The page uses Java Script for validation.  
      My question is:  I know I need to use ASP.NET to make a connection string to the DB to write directly to the DB.   I suggested we do all the paperwork the government wants and cut out the ftp stuff and writing to the text file and write directly from the web form to the DB.   So if I go in and start coding in ASP.NET with a html page that has java script, do  I just change the extention of the file to aspx?   Can you have ASP code and Java Script?  Would it be better to do the validation in VB script?  

     Sorry for the "TO MUCH INFO"...  usually when I post, some people will end up asking me a ton of questions post I didn't post enough history, hopefully I posted enough this time.  

      Also, I am new to web development and .NET.  I have a little experience in ASP but not ASP.NET.
     Thanks      
0
Comment
Question by:strongd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18864607
ASP/vbscript (server side) and javascript (clientside) work "together" fine.  In truth they are processed at different times and so one doesn't really see the other.  The first step is to change the file extension to one so the server will process the file (.aspx or, if not .net, .asp).  As you add the server side code then just make sure it is in server tags (e.g. <% [your code] %>).

Let me know what additional info or questions you have but it seems like that answers the question.

bol
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18864678
To clarify, ASP.NET also processes code with runat="server" as an attribute (e.g. <form runat=server>) and elements that start with asp: (e.g. <asp:textbox runat=server>).  I just wanted to make sure that mentioning just the common asp server tag (<%  %>) didn't confuse this.

bol
0
 

Author Comment

by:strongd
ID: 18864754
Ok... I have changed the extention to aspx...

Now in Visual Studio I am getting a few errors...  

Here is one...  Error      1      Cannot switch views: Validation (XHTML 1.0 Transitional): Element 'meta' cannot be nested within element 'div'.      

Here is another Error      5      File '_derived/nortbots.htm' was not found.      

What is nortbots.htm?  

Thanks again for your help...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:strongd
ID: 18864874
Here is another error
Error      9      Validation (XHTML 1.0 Transitional): Attribute 'webbot-onsubmit' is not a valid attribute of element 'form'

0
 

Author Comment

by:strongd
ID: 18867316
I seemed to have fixed the errors.

One more question however and I will give you the points.

Where should I place the ASP code???   Should it be at the end of the web file or the begin...

0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18867597
That I can answer quicker.  There is not one place to put it.  It really depends on what it is doing.  It can even be in a few places throughout the page.  The key is what it is doing for the page.  If it is directly helping to write some of the content (i.e. to make a table, maybe from database info) then it will be in the middle.  You can even use server script to write every line of html and so the whole thing is script.  Most of the time it is at least in the beginning of the page (i.e. validating information, making objects, etc).

Let me know if you have a question about this or need clarification.

bol
0
 

Author Comment

by:strongd
ID: 18867616
Ok...  The web form will need to validate data that is entered by the user, I think I got all the javascript doing that well now.

I would think that I would put the asp.net code at the end of all the validation.   After the user selects the drop down list, and gets no problems after the validation then asp.net will start...   grab the data that is in the textboxes or combo, and insert a new record in the DB with the info that is provided...

What do you think?? The end of the javascript???  
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 125 total points
ID: 18867912
It really depends on the code, the page, and what you want to have happen.

Is the form submitting to itself then?  In other words what do you have for the action in the form tag?

<form action="pagename.aspx" runat="server">

What do you want to have appear when the form is submitted?  Do you still want the form to appear and then have a message (i.e. "Data submitted successfully") appear at the bottom or do you want the form to disappear and just a "success" page to show?

It would help to get an idea of the code you are using.  You can use Javascript to validate the form but I would definitely use server script too.  Javascript can be disabled.  If the server script is ASP.NET then this is easier than with just ASP.  I have a lot more experience with ASP and only limited using .NET so I will be less help on .NET.

Basically the .NET code for validation, database insertion, and redirect/message can go almost anywhere but it really matters how you write it.  Since the server code is run first the server will "see" all of it but the code may need to be placed carefully.  It really just depends on the code.

I hope this, at least somewhat, answers the follow up question you asked.  If you are interested in a very basic "tutorial" on ASP.NET forms, validation, and processing then you might like http://www.4guysfromrolla.com/webtech/090200-1.shtml.  Let me know what you think or if you have a question.  To be specific on advise I will need to know more about the page.

bol
0
 
LVL 25

Expert Comment

by:kevp75
ID: 18868240
just my 2c...but if the goverment is worried about the security issues, why does this app use javascript validation on the forms?  Javascript is very easily circumvented by simply turning it off in the browser....

again...just my 2c
0
 

Author Comment

by:strongd
ID: 18875995
I went a head and gave you the points (b0lsc0tt) since you have helped me some...

You have got me started in the right direction.

I bought a book called Mastering Visual Web Developer 2005.    My question is to you:

I started messing with the Default.aspx.vb...    By using that, could I write a connection string in that file, so when a user gets through entering their data into the type boxes, I have a button called btnSubmit...  
When they click it, it go to the click event for that button and executes the VB code, which could be a connect string to the db and a routine to added the new inputs as a new record or update...

Will that work?
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18876576
>> Will that work?  <<

Yes.  That would be a basic summary of what happens.  I haven't personally used that book but it should be very helpful in learning ASP.NET.

I'm glad I could help you with this.  Thanks for the grade, the points and the fun question.

bol
0
 

Author Comment

by:strongd
ID: 18876618
No problem... I appreicate all your help!  

You have got me off to a good start.  You will probably see me on here over the next couple of month as I come up to speed on ASP.NET.

Thanks again for you help.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question