Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / May 2005

Tip: Looking for answers? Try searching our database.

Help! Newbie Question!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christian-Josef Schrattenthaler - 18 May 2005 09:20 GMT
Hi!

I am trying to create an ASP.NET Page with VJ#, but I never did this
bevore, and I dind't find a good dokumentation, so I have to ask for
help in this newsgroup.

How is the correct layout for an *.aspx file?

Is this like a JAVA or a VJ# file with "class" und "void main"?

I thougt this works over events for the page object (Page_Init,
Page_Load and so on), but with this system I can't share variables
between voids and HTML-Code.

Yet I have:

***
void Page_Load()
{
// What to do when page loads.
}

void xyz()
{
// For example what to do if button was clicked.
}

<html>
// The HTML-Code for the Webseite (form).
</html>
***

But with this system, I can't access the variables created in "void
page_load()" from "void xyz()" oder "html".

Thanks for your help,
christian.
Lars-Inge Tønnessen [VJ# MVP] - 18 May 2005 21:23 GMT
Hallo Christian-Josef,

My german is very bad so I will reply in english. I have not practiced
german for over 12 years.  :o)

I will strongly recomend Visual Studio for developing ASP.NET applications
and use the codebehind method. Let Visual Studio take care of alle the nuts
and bolts. But anyway here is an example I have made for you in notepad:

As you can see in the example, the "id" tags are the identifiers that glues
together the code and the html. Everything must be inside a form that runs
on the server. You do that by:

<form Runat="Server">
    bittte
</form>

If you want to store variables between calls, please use a session object.
You have to configure your IIS how you want to store the session on the
server. You can choose between in-process or in a SQL server.

Call this file for "default.aspx" and configure the IIS to execute it.

<%@ Page language="VJ#" %>

<Script Runat="Server">

   private void Page_Load(System.Object sender, System.EventArgs e)
   {
       if ( !this.get_IsPostBack() )
      {
         this.label.set_Text("Hello");
       }
   }

   protected void OnInit(System.EventArgs e)
   {
       InitializeComponent();
       super.OnInit(e);
   }

   private void InitializeComponent()
   {
       this.add_Load(new System.EventHandler(this.Page_Load));
   }

   public void ButtonClickHander( Object o, System.EventArgs e )
   {
     this.label.set_Text( this.textBx.get_Text() );
   }

</Script>

<head>
   <meta name="GENERATOR" content="Microsoft Notepad =:o)">
   <meta name="CODE_LANGUAGE" content="VJ#">
   <title>Your page</title>
</head>

<body >

<form Runat="Server">

<asp:TextBox id="textBx" Columns="30" Runat="Server" /><P>
<asp:Button id="But1" Text="Click me" OnClick="ButtonClickHander"
Runat="Server" /><P>
<asp:Label id="label" Text="Hello"  Runat="Server" />

</form>

</body>

Regards,
Lars-Inge Tønnessen

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.