0
我對每個查找表都有以下代碼。到目前爲止,我正在爲每個下拉列表控件進行復制/粘貼。但我認爲這樣做有更好的方法。我應該能夠指定DataTextField,DataValueField,控件名稱等。當然,我將不得不在數據庫端手動添加配置相關的數據庫值,如查找表和存儲過程中的其他更改。但在aspx頁面或頁面的.cs,必須有那麼一個更好的方法複製/粘貼..asp.net如何以編程方式將項目添加到detailsview
<asp:TemplateField HeaderText="Your Ethnicity">
<EditItemTemplate>
<asp:DropDownList ID="ddlEthnicity" runat="server"
DataSourceid="ddlDAEthnicity"
DataTextField="Ethnicity" DataValueField="EthnicityID"
SelectedValue='<%#Bind("EthnicityID") %>'
>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate >
<asp:Label Runat="server" Text='<%# Bind("Ethnicity") %>'
ID="lblEthnicity">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
請讓我知道... 感謝
順便說一句..我填充數據源如下: 的」 的SelectCommand =「選擇EthnicityID,種族從tblLkupEthnicity 「 > asp:SqlDataSource> –
2009-04-27 03:38:24