Solved

asp.net - issue with page_load with inline code...

Posted on 2010-09-18
10
597 Views
Last Modified: 2012-05-10
I dont think I have the page_load syntax correct on this..please help..

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Qualify_client.aspx.vb" Inherits="MASER_BUILD.Qualify_client" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



   
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.HttpStyleUriParser"%>
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Import Namespace="System.Data.DataSet"%>
<%@ Import Namespace="System.Data.SqlClient.SqlDataAdapter"%>
<%@ Import Namespace="System.CodeDom.Compiler"%>  
<%@ Import Namespace="System.Net"%>
<%@ Import Namespace="System.Diagnostics"%>
<%@ Import Namespace="System.Security.Cryptography" %>

   

<script runat="server">
    Public Sub Page_Init(ByVal object sender, ByVal EventArgs e)
       
    End Sub
    Sub Button1_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs) 'Handles Submit.Click
        ' LETS SEE
0
Comment
Question by:GlobaLevel
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 167 total points
ID: 33709524
Since this is VB, your method signatures should be:

    AccessModifier [Sub|Function] MethodName([ByVal|ByRef] VariableName As ObjectType)

That said, change your Page_Init method to:
Public Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
       
End Sub

Open in new window

0
 
LVL 14

Expert Comment

by:Dustin Hopkins
ID: 33709549
Do you mean the page load or page init?
I will provide the proper syntax for both.

Hope this helps,
Dustin
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Do Stuff
    End Sub
    Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        'Do Stuff
    End Sub

Open in new window

0
 
LVL 9

Assisted Solution

by:TonyReba
TonyReba earned 166 total points
ID: 33709905
Sub button 1 is not closed. Other than that I would suggest you use code behind to separate the logic of ir code. Double click on the control and u should be able to add the code in the event.
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33709959
whats the diff between LOAD and INIT?


can I ask one more question...

how do I take data stored into a variable and paste it into a txt file posted in my projected....
dim strData as string
strdata = "test"

my.computer.filesystem.saveAllText("C:/folder/file.txt") = strdata
0
 
LVL 9

Expert Comment

by:TonyReba
ID: 33709971


Yes Page_Init is pretty much similar to Page_Load. You can do all the things

which You did in Page_Load. But the major difference is Page_Load will be

fired each time when the page submits. Page_Init will be fired only once when

the page loads for the first time.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 33709981
>>  But the major difference is Page_Load will be
>>  fired each time when the page submits. Page_Init will be fired only once when
>>  the page loads for the first time.

That is not true. Page_Init fires before Page_Load, every time the page is requested. See http://msdn.microsoft.com/en-us/library/ms178472.aspx for more information.
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33709990
perfect!
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33710009
okay...this is a great link...I just need to load it once when the user first intializes the web site....doesnt have to wash and repeat during the session...
0
 
LVL 14

Assisted Solution

by:Dustin Hopkins
Dustin Hopkins earned 167 total points
ID: 33718508
If it just needs to run once when the user first hits the site and not the page then perhaps you should put it in global.asax under session_start().
0
 
LVL 10

Author Closing Comment

by:GlobaLevel
ID: 33780496
thnks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now