c# - Simple way to display an object (POCO) in an ASPX file -
first of all, let me start saying i'm not asp.net developer. have web experience other technologies have read webforms. know have no experience them.
and problem. have inherited webforms application has run unmodified years (~ 6 years) , have enhance it. it's not complicated, managed 80% of i'am stuck on thing seems minor have not yet found simple way achieve it.
i have simple object, instance of class this:
public class eventdetails { public string eventname { get; set; } public string eventlocation { get; set; } public datetime startdate { get; set; } //... etc }
i have created in eventdetails.aspx.cs
, need display in eventdetails.aspx
file , don't know how. have read tutorials , use <asp:gridview>
or list view or repeater. these have datasource bind to. can't use object directly datasource, seems need create myself idatasource
etc.
it seems complicated. need display thing, nothing else , don't know how. must simple, said have no experience this.
what simple way display plain object in aspx file?
create public
property in code-behind of type eventdetails
:
code-behind:
public partial class youraspxpage : page { public eventdetails eventdetails { get; set; } /* ... */ }
markup:
<span><%= eventdetails.eventname %></span>
Comments
Post a Comment