473,654 Members | 3,104 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.as px and PaymentPage.asp x.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.asp x

<%@ Page language="c#" Codebehind="Pay mentPage.aspx.c s"
AutoEventWireup ="false"
Inherits="Webpa y.NET_CSharpASP Sample.PaymentP age" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Webpay.N ET Start Page</title>
<meta content="VJ#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</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.asp x.cs

public class PaymentPage : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Labe l amount;

private void Page_Load(objec t sender, System.EventArg s e)
{
this.amount.Tex t = Request.Form["totalcost"];
}
}

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

Thanks in advance for your help.

Regards,
Nick.

Jun 13 '07 #1
1 1511
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.as px and PaymentPage.asp x.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.asp x

<%@ Page language="c#" Codebehind="Pay mentPage.aspx.c s"
AutoEventWireup ="false"
Inherits="Webpa y.NET_CSharpASP Sample.PaymentP age" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Webpay.N ET Start Page</title>
<meta content="VJ#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</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.asp x.cs

public class PaymentPage : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Labe l amount;

private void Page_Load(objec t sender, System.EventArg s e)
{
this.amount.Tex t = 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
14702
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 software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
121
10023
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 support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
11
2031
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 containing pointers into a "flattened" bit stream. Here is my code (it dosen't work). I would be grateful for any feedback that helps fix this. My intention
46
4197
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 believe MSFT should do to improve C#, however. I know that in the "Whidbey" release of VS.NET currently
13
5035
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
2705
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 button, seems simple. I am using ALL visual controls (supposedly to simplify things. If I was not using the visual controls and calling an ExecuteNonQuery no prob. Please look at my code and tell me what I am doing wrong. Also, what are the advatages...
16
1983
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. 1. constructor 2.Destructor 3.Copy constructor 4. Assignment operator
8
2061
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 vertices and can do this multiple times on a sinlge vertex cluster. The problem I have been encoutering is that, if I select a second vertex cluster and try to edit that , the program crashes.
0
1321
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 child controls (just a literal for testing) of my control is not being added to the page. Could someone tell me what am I doing wrong?
10
1793
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
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2719
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 we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.