c# - How to show members in Session with repeater? -


I log in to my master page and this code will be sent to my memberListing.aspx

  & lt; Asp: Repeater id = "rptmembers" runar = "server" & gt; & Lt; ItemTemplate & gt; & Lt; Div class = "username" & gt; & Lt;% # Eval ("strName")%> & Lt; / Div & gt; & Lt; Div class = "member siramani" & gt; & Lt;% # Eval ("strSurname")% & lt; / Div & gt; & Lt; ItemTemplate & gt; & Lt; / ASP: Repeater & gt;  

Behind the code

  Secure Zero Page_load (Object Sender, EventArgse E) {if (IsPostBack) {popMembers (); }} Protected zero pop () {datatable dtMembers = clsmembers.GetMemberList (); Stringbuilder sbMember = new stringbilder (); Rptmembers.DataSource = dtMembers; Rptmembers.DataBind (); }  

It works fine to display a list of members from DB, but how can I show all the members of the session? , If wrapping around a statement ....

  if (clsMembers = (clsmembers) session ["clsmembers"] == dtMembers) //// Some types of investigation { // When members of the session show up in session / when the session dies, the members will not be shown in the list unless they log back in}  

When there is a list of members stored in your session, the easiest way to bind it to repeaters is:

  • Type A Create a variable BindingList & lt
  • Members
  • Force Binding List
  • / Code> to repeat, e.g. rptMembers.DataSource = memeberBindingList

The easiest solution would be to store the binding list in the session, so it would be enough to:

  if (zero! = Session ["class member"]) {rptmembers.DataSource = (bidding list and member; member & gt;) session ["clm member"]; Rptmembers.DataBind (); }  

Comments