asp.net - ListView Item binding does not work -
i'm new asp.net(webforms). follow tutorial --> http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/ui_and_navigation
in site.master i've added following code described in tutorial:
<section style="text-align: center; background-color: #fff"> <asp:listview id="categorylist" itemtype="vanchoworks.models.category" runat="server" selectionmethod="getcategories" > <itemtemplate> <b style="font-size: large; font-style: normal"> <a href="/productlist.aspx?id=<%#: item.categoryid %>"> <%#: item.categoryname %> </a> </b> </itemtemplate> <itemseparatortemplate> - </itemseparatortemplate> </asp:listview> </section> in code-behind(site.master.cs)
public iqueryable<category> getcategories() { var db = new productcontext(); iqueryable<category> query = db.categories; return query; } but no sign of listview shown when run application. added breakpoint in getcategories() line 1, not stop there, makes me think i've not setup selectionmethod well. why that?
change selectionmethod="getcategories" selectmethod="getcategories"
Comments
Post a Comment