怎样在模板中加入服务器控件
okcat 2009-01-05 10:14:55
<html>
<body>
<asp:datalist id="dl" selecteditemstyle-backcolor="#cccc99" repeatlayout="table" repeatdirection="Vertical" datakeyfield="userid" onitemcommand="dl_itemcommand" runat="server">
<itemtemplate>
<asp:button text=<%#container.dataitem("firstname")&""&container.dataitem("lastname")%> command="select" runat="server"/>
</itemtemplate>
<selecteditemtemplate>
<%#container.dataitem("firstname")&""&container.dataitem("lastname")%><br>
phone:
<%#container.dataitem("phone")%><br>
address:
<%#container.dataitem("address")%><br>
<%#container.dataitem("city")%><br>
<%#container.dataitem("state")%><br>
<%#container.dataitem("zip")%><br>
</selecteditemtemplate>
</asp:datalist>
</body>
</html>
错误提示为Control 'dl__ctl0__ctl0' of type 'Button' must be placed inside a form tag with runat=server. 在模板中加入服务器控件呢???