在datagrid中放入一個dropDownList(忘了這個問題在那里看到的了CSDN or Th
2024-07-21 02:16:52
供稿:網友
其實很簡單,只要將這一類的東東都放到 <edititemtemplate>里就行了
<edititemtemplate>
<asp:dropdownlist id="cmbcategories" runat="server"></asp:dropdownlist>
</edititemtemplate>
就可以在cs中操作它了,填充數據,等等等等
<asp:datagrid id="dgproducts" runat="server" autogeneratecolumns="false" datakeyfield="productid" cellpadding="4" borderwidth="1px" bordercolor="#dedfde" backcolor="white" borderstyle="none" gridlines="vertical" forecolor="black">
<selecteditemstyle font-bold="true" forecolor="white" backcolor="#ce5d5a"></selecteditemstyle>
<alternatingitemstyle borderstyle="double" bordercolor="#0000c0" backcolor="white"></alternatingitemstyle>
<itemstyle cssclass="header" backcolor="#f7f7de"></itemstyle>
<headerstyle font-bold="true" forecolor="white" backcolor="#6b696b"></headerstyle>
<footerstyle backcolor="#cccc99"></footerstyle>
<columns>
<asp:boundcolumn datafield="productname" headertext="name"></asp:boundcolumn>
<asp:templatecolumn headertext="category">
<itemtemplate>
<%# container.dataitem("categoryname")%>
</itemtemplate>
<edititemtemplate>
<asp:dropdownlist id="cmbcategories" runat="server"></asp:dropdownlist>
</edititemtemplate>
</asp:templatecolumn>
<asp:editcommandcolumn buttontype="pushbutton" updatetext="update" canceltext="cancel" edittext="edit"></asp:editcommandcolumn>
</columns>
</asp:datagrid>網站運營seo文章大全提供全面的站長運營經驗及seo技術!