Link to home
Start Free TrialLog in
Avatar of fippif
fippif

asked on

define variables in .aspx.cs and use in .aspx

I have defined a string variable in .aspx.cs file, and I want to use that variable in the .aspx file.

In .aspx.cs file I have:

private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here
                  string Test = "------ test -------";
            }

In .aspx file I have:

<%@ Page language="c#" Codebehind="WebForm7.aspx.cs" AutoEventWireup="false" Inherits="FileEditor2.WebForm7" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
            <title>WebForm7</title>
            <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" Content="C#">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
      </HEAD>
      <body MS_POSITIONING="GridLayout">
            <form id="Form1" method="post" runat="server">
            
            
            <%=Test%>
            
            
            
            </form>
      </body>
</HTML>
ASKER CERTIFIED SOLUTION
Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial