Johan Knape Posted December 3, 2004 Share Posted December 3, 2004 Har ett problem med ett försök till codebehind som jag inte riktigt förstår mig på. Har index.aspx & index.aspx.vb och gör på följande sätt. index.aspx <%@ Page language="VB" src="index.aspx.vb" AutoEventWireup="false" Inherits="MyEconomy.Web._Default" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Min sida</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> Johan asdfasdf<br/> <asp:Label Text="test" id="MinLabel" runat="server"/> </body> </html> index.aspx.vb ' VB Document Option Strict Option Explicit Imports System Imports System.Collections Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Web Imports System.Web.SessionState Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Imports MyEconomy.Web namespace MyEconomy.Web '/// <summary> '/// Summary description for _Default. '/// </summary> public class _Default Inherits MyEconomy.Web.MyEconomyPage Protected MinLabel As Label private sub Page_Load(Sender As object, E As System.EventArgs) Dim i as Integer i = Convert.ToInt32("1") MinLabel.Text = "Johan" End Sub End Class End Namespace Mitt problem är att inget händer med MinLabel. Den förblir test men den borde jhu helt klart få texten Johan. VAD gör jag fel? /Johan Link to comment Share on other sites More sharing options...
pudenda Posted December 6, 2004 Share Posted December 6, 2004 Du borde no g ha med: Handles MyBase.Load Alltså: Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load Sen borde du inte ha src i din aspx-fil, då detta egetnligen inte stöds längre av .net Framework har jag för mig. Sätt som codebehind och "build:a" ditt projekt istället Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.