我有一個asp gridview,我想填充下拉列表控件,當選定的行切換到編輯模式。Gridview中的下拉列表不在編輯模式下填充
<EditItemTemplate>
<asp:DropDownList ID="ddlFormatID" runat="server">
</asp:DropDownList>
心中已經GOOGLE了四周,我知道你想這樣做在的RowDataBound,然後檢查是否該行正在編輯的一個,如果這樣的話填充DDL,但我可以「T獲得檢查該行正常工作:(
If DataControlRowState.Edit = e.Row.RowState Then
Dim ddlFormat As DropDownList = e.Row.FindControl("ddlFormatID")
ddlFormat.DataSource = XRefBCWorker.GetFormatCombos
ddlFormat.DataTextField = "Format"
ddlFormat.DataValueField = "FormatID"
ddlFormat.DataBind()
End If
我到底做錯了什麼?
嘗試在GridView的RowEditing事件做。另外請查看http://msdn.microsoft.com/en-us/library/ie/ms178294.aspx – 2013-02-14 17:51:45