我有下面的设置。当我单击 CommandField 上的“编辑”链接时,会触发 RowEditing 事件,但该行不允许我编辑;具体来说,DropDownList 没有出现。
我的代码似乎符合我能找到的所有示例。
我可能错过了一些非常基本的东西,因为我似乎是互联网上唯一遇到这个问题的人。我渴望另一双眼睛。
谢谢。
<asp:GridView ID="grdvMachine1" runat="server" AutoGenerateColumns="False" CellSpacing="2"
CssClass="GridViewFormat" GridLines="None" Width="500px"
OnRowUpdating="grdvMachine1_RowUpdating" OnRowUpdated="grdvMachine1_RowUpdated"
OnRowEditing="grdvMachine1_RowEditing" OnRowDeleting="grdvMachine1_RowDeleting">
<PagerSettings Position="Top" />
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<Columns>
<asp:BoundField DataField="Day Of Week" HeaderText="Day Of Week" SortExpression="Day Of Week" />
<asp:TemplateField HeaderText="Package" SortExpression="Package">
<EditItemTemplate>
<asp:DropDownList ID="comboPackageNames"
runat="server"
DataSourceID="PackageNames"
DataTextField="PackageName"
DataValueField="PackageName"
SelectedValue='<%# Bind("Package") %>'>
</asp:DropDownList>
<asp:ObjectDataSource ID="PackageNames" runat="server" SelectMethod="GetSPPList"
TypeName="PCS.WebApp.DefaultSchedules">
</asp:ObjectDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Package") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="true" ShowDeleteButton="true"/>
</Columns>
<RowStyle BackColor="#EEEEEE" ForeColor="Black" HorizontalAlign="Center" VerticalAlign="Middle" />
<EmptyDataTemplate>
There is no schedule for the selected machine
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="False" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
<AlternatingRowStyle BackColor="Gainsboro" />
</asp:GridView>