in the aspx page, I want to replace \"FirstName\" to <%#Eval(employee.FirstName)%> but \"employee\" object" />
开发者

Access object in codebehind from aspx page

开发者 https://www.devze.com 2023-01-17 04:55 出处:网络
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

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.


Try <%= 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)%>
0

精彩评论

暂无评论...
验证码 换一张
取 消