私は次のことを達成しようとしています:
FormView’s
デフォルトの編集リンク ボタンを削除します。現在のデータと追加の DDL データを選択して
FormView
、編集モードで表示します。Page_Load
id = x
現在、DDLを現在のデータベース値などに基づいてバインドするために、次のものがあります。
<asp:DropDownList ID="DropDownList1" runat="server"
SelectedValue='<%# Bind("xxx") %>'
DataSourceID="xxx"
DataTextField="xxx"
DataValueField="xxx"
ondatabound="DropDownList1_DataBound">
C# コードを使用して、選択用の DDL リスト項目を追加するためにこれを行います (データが既にデータベースにあるため、これはエネルギーの無駄です!)
protected void DropDownList1 _DataBound(object sender, EventArgs e)
{
DropDownList DropDownList1 = (DropDownList)FormView1.FindControl("DropDownList1");
DropDownList1.Items.Insert(1, new ListItem("0 - 1 km/h", "0"));
DropDownList1.Items.Insert(2, new ListItem("2 - 5 km/h", "1"));
DropDownList1.Items.Insert(3, new ListItem("6 - 11 km/h", "2"));
DropDownList1.Items.Insert(4, new ListItem("12 - 19 km/h", "3"));
DropDownList1.Items.Insert(5, new ListItem("20 - 28 km/h", "4"));
}
もっと良い方法があるに違いない!