[Mono-list] codebehind question

Todd Turner toddt at pacificwebworks.com
Thu Nov 1 18:37:11 EDT 2007



 Hello - just trying to get a codebehind control to work using gmcs - 

 suggestions appreciated:


 In the aspx file's @page directive - I've swapped out using the Inherits
and using src 

 instead of CodeFile (always same results).


 gmcs -v /t:library /out:amazonecs.dll -r:System.Web -r:System.Data 

 -r:System csharp.aspx.cs

 csharp.aspx.cs(18,9): error CS0103: The name `testlabel' does not 

 exist in the current context Compilation failed: 1 error(s), 0 



 (aspx page)

 <%@ Page Language="C#" AutoEventWireup="true"

 CodeFile="csharp.aspx.cs" Inherits="csharp" %


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"



 <html xmlns="http://www.w3.org/1999/xhtml&quot;  <head 


     <titleUntitled Page</title




     <form id="form1" runat="server" 


     <asp:label id="testlabel" runat="server"</asp:label  






 (csharp.aspx.cs codebehind file)


 using System;

 using System.Data;

 using System.Configuration;

 using System.Collections;

 using System.Web;

 using System.Web.Security;

 using System.Web.UI;

 using System.Web.UI.WebControls;

 //using System.Web.UI.WebControls.WebParts;

 using System.Web.UI.HtmlControls;


 partial class csharp : System.Web.UI.Page {

     //   protected System.Web.UI.WebControls.Label testlabel; 


     protected void Page_Load(object sender, EventArgs e) 



    testlabel.Text  = "test codebehind"; 

    //Response.Write = "test codebehind"; 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071101/c7fed8c4/attachment.html 

More information about the Mono-list mailing list