Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

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

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
GlobaLevel
Asked:
GlobaLevel
  • 4
  • 2
  • 2
  • +1
3 Solutions
 
käµfm³d 👽Commented:
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
 
Dustin HopkinsCommented:
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
 
TonyRebaCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
GlobaLevelAuthor Commented:
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
 
TonyRebaCommented:


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
 
käµfm³d 👽Commented:
>>  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
 
GlobaLevelAuthor Commented:
perfect!
0
 
GlobaLevelAuthor Commented:
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
 
Dustin HopkinsCommented:
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
 
GlobaLevelAuthor Commented:
thnks
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now