简体   繁体   中英

Access object in codebehind from aspx page

C# or VB.NET are welcome.

I have an <%#Eval("FirstName")%> in the aspx page, I want to replace "FirstName" to <%#Eval(employee.FirstName)%> but "employee" object is instantiated in the codebehind like this:

Public employee As New Employee
  • How can I call this object in the aspx page?

  • Should I can create an "employee" in the aspx? if so, how to do that.

尝试<%= Employee.FirstName%>

Since you instantiate your object as Public you should be able to call it, even from aspx page.

<%#Eval(employee.FirstName)%>

If you are trying to access something inside a databound control, use:

<%#Eval(employee.FirstName)%>

For general us in a .aspx or .ascx, use:

<%#Eval(employee.FirstName)%>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM