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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -