943,522 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 4927
  • ASP.NET RSS
Aug 7th, 2004
0

My first attempt at ASP.NET...

Expand Post »
My first attempt at ASP.NET...

I would like to convert my current website to .NET as a way to get the feel for the new environment. In my current website, I have code which checks a database to find out which menus to display and then loads them accordantly. I have tried to make this happen in ASP.NET with no success. Could some one please help?

What I would like to have help with is simple. I would like to have an ASP form which only says "Hello World", but the entire HTML page is generated in the WebForm1.aspx.vb Page_Load event. I thought this would be a rather easy process, but I have yet to have the ASP.NET call the Page_Load event. Is there something special which must be done?

Any help would be appreciated, and thanks in advance.

- Eric
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecashwell is offline Offline
22 posts
since Aug 2004
Aug 8th, 2004
0

Re: My first attempt at ASP.NET...

Ok, well I'm assuming you know you're running your scripts on a .NET enabled server. Also, I'm assuming you're using your WebForm1.aspx.vb as your code behind page (which is loaded at the top of the *.aspx page. If this isn't the case, take off the .vb
I.e. don't type in a URL like http://www.somesite.com/someDir/somePage.aspx.vb it shouldn't have the .vb
As for the page load, there should be a method in your aspx file that's something like (forgive me if it's wrong because I don't have my docs to look at right now)
ASP.NET Syntax (Toggle Plain Text)
  1. public void OnPage_Load(object sender, EventArgs e){
  2. if(Page.IsPostBack()){
  3. // do stuff if the page is posted back
  4. } else {
  5. // Do stuff only the first time the page loads
  6. }
  7. // do stuff no matter which time the page loads
  8. }

That's all in C# but you should get the idea. Once I check my docs, I'll get back to you if it's wrong
Reputation Points: 46
Solved Threads: 2
Junior Poster
Iron_Cross is offline Offline
117 posts
since Jul 2003
Aug 10th, 2004
0

Re: My first attempt at ASP.NET...

Yes my server handles .NET. I have made small ASP.NET forms which display and work. Now I need to create the entire HTML dynamically. Whenever I run my code, .NET populates it's own HTML to run and never enters the Page_Load event. Here is all my code....

dynamic_page.aspx: (I have set the AutoEventWireup to both True and False...)
ASP.NET Syntax (Toggle Plain Text)
  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="dynamic_page.aspx.vb" %>

dynamic_page.aspx.vb:
ASP.NET Syntax (Toggle Plain Text)
  1. Public Class dynamic_page
  2. Inherits System.Web.UI.Page
  3.  
  4. #Region " Web Form Designer Generated Code "
  5.  
  6. 'This call is required by the Web Form Designer.
  7. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  8.  
  9. End Sub
  10.  
  11. Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  12. 'CODEGEN: This method call is required by the Web Form Designer
  13. 'Do not modify it using the code editor.
  14. InitializeComponent()
  15. End Sub
  16.  
  17. #End Region
  18.  
  19. Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  20. 'Put user code to initialize the page here
  21. If Not Page.IsPostBack Then
  22. Response.Write("<html><head></head><body>Eric</body></html>")
  23. End If
  24. End Sub
  25.  
  26. End Class

HTML returned from server to client box:
ASP.NET Syntax (Toggle Plain Text)
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML><HEAD>
  3. <META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD>
  4. <BODY></BODY></HTML>


*** On another note: Why does my VS.NET always place
ASP.NET Syntax (Toggle Plain Text)
  1. Inherits="www.derivetech.us.dynamic_page"
in the "<% @ Page" tag? It causes the page to display an error for line 1.

Thanks for your time and help.
- Eric
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecashwell is offline Offline
22 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: ADO.NET Specified cast is not valid
Next Thread in ASP.NET Forum Timeline: ASP.NET <--> XML <--> VB6.0





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC