473,770 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner needs help -- Simple AspNet Component

I coded my first asp form and attempted to display a text message from a component. The static text "Our component
says:" shows on the aspx page, but the text line from the component does not show. No errors are produced.

Can someone get me started down the right path with aspnet?

The two modules are shown below. The solution, less the .dll and .pdb files, can ge grabed at
http://psiprograms.com/Programs/HelloWorld.zip (about 16 Kb).

Thanks, Jim Holloman
----aspx page-------------------------------------------------------------------
<%@ Import Namespace="Hell oWorldApp" %>
<%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false" Inherits="Hello WorldApp.WebFor m1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema" content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
Our component says: &lt; br /&gt; &lt; br /&gt;
<asp:Label ID="Labe11" runat="server"> </asp:Label>

<!-- Putting the code within the "form" creates a server error indicating that Page_Load()
is already defined -->
<!--
<script language="C#" runat="server">
void Page_Load( Object sender, EventArgs e )
{
HelloWorld oHelloWorld = new HelloWorld();
Labe11.Text = oHelloWorld.Say Hello();
}
</script>
-->

</form>

<!-- This code apparently does nothing! -->
<script language="C#" runat="server">
void Page_Load( Object sender, EventArgs e )
{
HelloWorld oHelloWorld = new HelloWorld();
Labe11.Text = oHelloWorld.Say Hello();
}
</script>

</body>
</HTML>
----Hello World component-------------------------------------------------------
using System;

namespace HelloWorldApp
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class HelloWorld
{
public HelloWorld()
{
// TODO: Add constructor logic here
}

public string SayHello()
{
return "Hello World -- form a C# component developed with the Visual Studio IDE \n\n";
}
}
}
Nov 17 '05 #1
1 1405
Hi,
Putting the code within the "form" creates a server error >indicating

that Page_Load()

You have two ways that you can write your server code : using code
behind (personally, i prefer it) or embedding the code in the ASPX file
(as you do) but you cant do them both.

Remove the code that attach the page load event (this.Load +=
EventHandler(Pa ge_load)) and you wont get the above error. Or write
server side code in the code behind.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2

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

Similar topics

12
1890
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that the build fails with what the book tells me to do. Specifically, I am doing this: public authors1 GetAuthors() { authors1 authors = new Authors1();
19
2987
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
7
1670
by: M. Simioni | last post by:
Hi, i'm always auditing ASPNET's account accesses on my webserver, a WIN2K_SP4 + IIS5 + SQLServer2K_SP3a machine. Nearly all the applications work correctly, but i constantly find a message in the event viewer under the protection log, that says: --------------------------------------- Apertura oggetto: Server oggetto: Security Tipo oggetto: File
7
2525
by: SK | last post by:
Hi, Would appreciate if anyone could help me on this. Basically my client having few branches across state. And they used Citrix in which to connect to the server side for accessing application running on ASPNET (C# code behind). Basically, all my form was coded as user control and loaded as component to the IFrame. The problem is when browsing the page, it could not be loaded. and there
1
2198
by: tooniron | last post by:
Dear All, I am new to the world of web services (as will become apparent), and I am writing a VB.NET application which needs to use an Apache Web Service. The Web Service has no .wsdl, so I am unable to use the .NET Add Web Reference option. I have managed to make a request to the webservice using a msxml2.xmlhttp object (.open("POST",<webserviceaddress>,False), and receive a response with no problems. However, once I have sent the...
6
3008
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python interface is providing a convenient scripting toolkit for the application. One example is that a user can write a python script like: player = Player() game.loadPlayer(player) player.moveTo(location)
1
4013
by: ashie | last post by:
Hi! I want to make a simple login page. Using the objects Login CreateUserWizard etc of the toolbox of visual studio i've realized simply my page.. But it is possibile to connect this templates to my database and not to aspnet.mdb? i want to have a unique sqlserver remote database and insert login information there and not in the aspnet.mdb. Tnx! betta
1
1254
by: esource | last post by:
Hi all, has anyone been successful in forcing impersonation of the ASPNET account that calls a component through com interop? I have tried doing it programmatically, through IIS, through the web config file and all do not work. The ASPNET account always seems to access my com components. I have a .net web service trying to call a com+ component programmed in VB6. thanks in advance
22
18151
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php programmer and looking for a starting point in regards to practical projects to work on. What are some projects that beginner programmers usually start with? Please list a few that would be good for a beginner PHP programmer to
0
10099
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
10036
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
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
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
7451
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
6710
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
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
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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.