c# - Binding ASP.Net listview trouble -


please me binding. have page:

         <asp:listview runat="server" id="mylistview" datasource='<%#q%>'>     <layouttemplate>         <table runat="server" border="1">             <tr runat="server">                 <th runat="server">check</th>                 <th runat="server">path</th>                 <th runat="server">size</th>                 <th runat="server">modified</th>             </tr>             <tr runat="server" id="itemplaceholder">             </tr>         </table>     </layouttemplate>     <itemtemplate>         <tr runat="server">             <td>                 <asp:checkbox runat="server"/>             </td>             <td>                 <asp:label id="path" runat="server" text='<% #bind("path")%>'></asp:label>             </td>             <td>                 <asp:label id="size" runat="server" text='<% #bind("size")%>'></asp:label>             </td>             <td>                 <asp:label id="modified" runat="server" text='<% #bind("modified")%>'></asp:label>             </td>         </tr>     </itemtemplate> </asp:listview> 

and code behind:

    public static list<data> q = new list<data>();      protected void page_load(object sender, eventargs e)     {         if (!ispostback)         {             q.add(new data("qwe", "qwe", "qwe"));             q.add(new data("asd", "asd", "asd"));             q.add(new data("zxc", "zxc", "zxc"));              this.mylistview.datasource = q;             this.mylistview.databind();          }     }      public class data     {         private string path;         private string size;         private string modified;          public data(string path, string size, string modified)         {             path = path;             size = size;             modified = modified;         }     } 

how should binding in situation. in wpf can bind list datacontext , use each variable below. sorry english. thanks.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -