大家好,又见面了,我是你们的朋友全栈君。 DetailsView使用DropDownList1
类型
“>
<EditItemTemplate>
<asp:DropDownList ID=”DropDownList2″ runat=”server”>
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID=”DropDownList1″ runat=”server”>
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>33</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
(DetailsView1_ItemInserting)
或更新
(DetailsView1_ItemUpdating)
事件中加入
代码
:
string str=((DropDownList)DetailsView1.Rows[3].Cells[1].FindControl(“DropDownList1”)).SelectedValue
e.Values.Add(“
你的绑定的名字
“, str);
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/161242.html原文链接:https://javaforall.net