473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page load event is not firing.

Please help : page load event is not firing.
--------------------------------------------------------------------------------

Hi,
I am a new to .net. I am trying to learn it.
I tried the following code to execute. But the page load event is not firing. I tried , the same function rewriten in C#, then page load event worked absolutely fine.
I dont know why the page load event is not firing in VB.net . Could some one try please try my same code, what I posted here and suggest me what is the wrong in it. I am comfortable with vb6 and classic asp. So I want to learn first ASp.net with vb. I tried some other codes to fire page load event from different books, but effect is same. So please help me.

Many thanks.

My code


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm5.aspx.vb" Inherits="Myapplication.WebForm5"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>WebForm1</title>
<script language="javascript">
function valSubmit() {
var doc = document.forms[0];
var msg = "";
if (doc.firstName.value == "") {
msg += "- Please enter a first name.n";
}
if (doc.lastName.value == "") {
msg += "- Please enter a last name.n";
}
if (msg == "") {
doc.submit();
return true;
} else {
alert("The following errors were encountered.nn" + msg);
return false;
} }
</script>
<script language="vb" runat="server">
Private sub btnSearch_Click(sender As Object, e As System.EventArgs)
Response.Write("Search")
End Sub
sub Page_Load(sender As Object, e As System.EventArgs)
response.write ("test")
btnSubmit.Attributes.Add("onClick", "return valSubmit();")
End Sub
</script>
</head>
<body>
<form id="frmBuilderTest" method="post" runat="server">
<label style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 48px">
First Name:</label>
<input style="Z-INDEX: 102; LEFT: 88px; POSITION: absolute; TOP: 48px" type="text" name="firstName" id="firstName">
<label style="Z-INDEX: 103; LEFT: 10px; POSITION: absolute; TOP: 88px">
Last Name:</label>
<input style="Z-INDEX: 104; LEFT: 88px; POSITION: absolute; TOP: 88px" type="text" name="lastName" id="lastName"><br />
<br />
<asp:Button id="btnSubmit" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute;
TOP: 128px" runat="server" Text="Submit" Width="136px" OnClick="btnSearch_Click"></asp:Button>
</form>
</body>
</html>
May 12 '07 #1
1 2822
chinu
36
Please help : page load event is not firing.
--------------------------------------------------------------------------------

Hi,
I am a new to .net. I am trying to learn it.
I tried the following code to execute. But the page load event is not firing. I tried , the same function rewriten in C#, then page load event worked absolutely fine.
I dont know why the page load event is not firing in VB.net . Could some one try please try my same code, what I posted here and suggest me what is the wrong in it. I am comfortable with vb6 and classic asp. So I want to learn first ASp.net with vb. I tried some other codes to fire page load event from different books, but effect is same. So please help me.

Many thanks.

My code


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm5.aspx.vb" Inherits="Myapplication.WebForm5"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>WebForm1</title>
<script language="javascript">
function valSubmit() {
var doc = document.forms[0];
var msg = "";
if (doc.firstName.value == "") {
msg += "- Please enter a first name.n";
}
if (doc.lastName.value == "") {
msg += "- Please enter a last name.n";
}
if (msg == "") {
doc.submit();
return true;
} else {
alert("The following errors were encountered.nn" + msg);
return false;
} }
</script>
<script language="vb" runat="server">
Private sub btnSearch_Click(sender As Object, e As System.EventArgs)
Response.Write("Search")
End Sub
sub Page_Load(sender As Object, e As System.EventArgs)
response.write ("test")
btnSubmit.Attributes.Add("onClick", "return valSubmit();")
End Sub
</script>
</head>
<body>
<form id="frmBuilderTest" method="post" runat="server">
<label style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 48px">
First Name:</label>
<input style="Z-INDEX: 102; LEFT: 88px; POSITION: absolute; TOP: 48px" type="text" name="firstName" id="firstName">
<label style="Z-INDEX: 103; LEFT: 10px; POSITION: absolute; TOP: 88px">
Last Name:</label>
<input style="Z-INDEX: 104; LEFT: 88px; POSITION: absolute; TOP: 88px" type="text" name="lastName" id="lastName"><br />
<br />
<asp:Button id="btnSubmit" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute;
TOP: 128px" runat="server" Text="Submit" Width="136px" OnClick="btnSearch_Click"></asp:Button>
</form>
</body>
</html>
Change AutoEventWireup="false" to AutoEventWireup="true"
Jun 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JJ | last post by:
Hi, In asp.net my Page Load isn't firing so I am guessing it has to do with not being wired to interface page? I am using codebehind for the page. What am I missing? Thanks, JJ
1
by: RedGST | last post by:
Hello, Im somewhat new to asp.net, so bear with me. I have created a form that has a Listbox along with 2 command buttons & a few other non-important controls. The command button is tied to...
3
by: cmay | last post by:
In reading some documents from the Patterns and Practices group, I had a question about the example given for the Page Controller pattern. (I have posted the code for the BasePage below) In...
3
by: Jim Heavey | last post by:
Hello, I have a web application and I am unable to get the debugger to run on a particular page. I place a "stop" on the page load, but the program does not stop on the page load. If I go to...
5
by: Engineerik | last post by:
I have a login form which I want to display with the showdialog method. When I do that the event handler for the load event does not run. If I use the show method the load event handler runs...
6
by: snazzy | last post by:
I have a problem where using innerHTML to rewrite a DIV or removeChild to kill a DIV that either of them, if excuted before the page is done loading will stop the page in its tracks. ...
1
by: thedotnetarchitect | last post by:
Can anyone tell me why my page load event is firing more then once? I have a asp.net 2.0 page with four user controls and it seems that the user controls are loading but the page load event seems...
3
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
4
by: Seth Williams | last post by:
If I have some Master Page properties, and assign them when the master page first loads, knowing that I can access these property values in the current Content pages, will these properties be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.