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.
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
Don't see what you're looking for? Try a search.
|