473,503 Members | 1,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What am I doing wrong?

Hi,

I'm at my wits-end here. I'm a beginner with ASP/C# (using .NET 2003)
and I'm trying to post variables from a classic ASP form to a ASP.NET
form. The Classic ASP form was scripted with VBScript whereas the
ASP.NET page is scripted with C#.

My issue is this: I have two files within the site's working directory
(PaymentPage.aspx and PaymentPage.aspx.cs). The .cs file is the
codebehind for the aspx file. Basically, I can ouput the posted
variable from the top of the aspx file using:
<% Response.Write(Request.Form["totalcost"])); %>
....but if I try to do this further down the page, nothing will show
up.

So, now I'm expecting the Page_Load() method to do the work for me
(since it's on a codebehind file) but nothing is happening there
either. Does anyone know what I'm doing wrong? The basic problem is
shown below:

PaymentPage.aspx

<%@ Page language="c#" Codebehind="PaymentPage.aspx.cs"
AutoEventWireup="false"
Inherits="Webpay.NET_CSharpASPSample.PaymentPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Webpay.NET Start Page</title>
<meta content="VJ#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="amount" style="Z-INDEX: 111; LEFT: 152px; POSITION:
absolute; TOP: 80px" runat="server"
Font-Bold="True"></asp:label>
</form>
</body>
</html>

------------------------------

PaymentPage.aspx.cs

public class PaymentPage : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label amount;

private void Page_Load(object sender, System.EventArgs e)
{
this.amount.Text = Request.Form["totalcost"];
}
}

-----------------------------

Thanks in advance for your help.

Regards,
Nick.

Jun 13 '07 #1
1 1503
2 things:
1) Set AutoeventWireup to "true", unless you plan on hooking up your own
event handlers.
2) post asp.net questions to the ASP.NET newsgroup, not the c# language group:

http://msdn.microsoft.com/newsgroups...k.aspnet&fltr=

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Nicko." wrote:
Hi,

I'm at my wits-end here. I'm a beginner with ASP/C# (using .NET 2003)
and I'm trying to post variables from a classic ASP form to a ASP.NET
form. The Classic ASP form was scripted with VBScript whereas the
ASP.NET page is scripted with C#.

My issue is this: I have two files within the site's working directory
(PaymentPage.aspx and PaymentPage.aspx.cs). The .cs file is the
codebehind for the aspx file. Basically, I can ouput the posted
variable from the top of the aspx file using:
<% Response.Write(Request.Form["totalcost"])); %>
....but if I try to do this further down the page, nothing will show
up.

So, now I'm expecting the Page_Load() method to do the work for me
(since it's on a codebehind file) but nothing is happening there
either. Does anyone know what I'm doing wrong? The basic problem is
shown below:

PaymentPage.aspx

<%@ Page language="c#" Codebehind="PaymentPage.aspx.cs"
AutoEventWireup="false"
Inherits="Webpay.NET_CSharpASPSample.PaymentPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Webpay.NET Start Page</title>
<meta content="VJ#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="amount" style="Z-INDEX: 111; LEFT: 152px; POSITION:
absolute; TOP: 80px" runat="server"
Font-Bold="True"></asp:label>
</form>
</body>
</html>

------------------------------

PaymentPage.aspx.cs

public class PaymentPage : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label amount;

private void Page_Load(object sender, System.EventArgs e)
{
this.amount.Text = Request.Form["totalcost"];
}
}

-----------------------------

Thanks in advance for your help.

Regards,
Nick.

Jun 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
14539
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
121
9905
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
11
2009
by: Alfonso Morra | last post by:
Hi, I am at the end of my tether now - after spending several days trying to figure how to do this. I have finally written a simple "proof of concept" program to test serializing a structure...
46
4153
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
4997
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
2
2697
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
16
1966
by: Ajay | last post by:
Hi all, i want to know when i create a class.what all it contains.I know the following things are there by default if i do not declare them by myself.Please tell the other things that are left. ...
8
2055
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the...
0
1316
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the...
10
1773
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.