1

DefaultMode = "Edit"に設定されたasp:DetailsViewがあります。これには、次のコマンドボタンがあります

<asp:CommandField HeaderText="Action" ShowEditButton="True" ShowInsertButton="true" UpdateText="Save Changes" ShowCancelButton="true" ButtonType="Button" ControlStyle-CssClass = "button" />

問題は、[変更を保存] 更新ボタンをクリックすると、ItemCommand イベントが発生しないことです。

<asp:DetailsView ID="dvPerson" runat="server"
                DataKeyNames="PersonID"
                AutoGenerateRows="False" CellPadding="4" Width="1000"
                ForeColor="#333333" GridLines="None" DefaultMode="Edit" Visible="False">                           
    <PagerStyle BackColor="#949EAA" HorizontalAlign="Center" />
    <Fields>                                 
        <asp:BoundField DataField="Phone" HeaderText="Phone"
            SortExpression="Phone" Visible="true" ReadOnly="true"
            ItemStyle-VerticalAlign="Top" />
        <asp:BoundField DataField="Email" HeaderText="Email"
            SortExpression="Email" Visible="true" ReadOnly="true"
            ItemStyle-VerticalAlign="Top" />
        <asp:TemplateField HeaderText="Primary Manager Contact"
            ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center">
            <EditItemTemplate>
                <asp:CheckBox runat="server" ID="cbxPrimaryManagerContact" Checked='<%# IsPrimaryMC(Eval("PersonID")) %>' Enabled="true" /></EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Training Assignments"
            ItemStyle-VerticalAlign="Top">
            <EditItemTemplate>
                <asp:Label ID="lblTraining" runat="server" Text='<%# getTraining(Eval("PersonID")) %>' /><p>&nbsp;</p>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Job Roles"
            ItemStyle-VerticalAlign="Top">
            <EditItemTemplate>
                <asp:CheckBoxList ID="lbxJobRoles" runat="server" DataSourceID="sqlJobRole" DataValueField="JobRoleID" DataTextField="JobRole" RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Table" CellPadding="2" CellSpacing="2" Width="1000" CssClass="the300" /><p>&nbsp;</p>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Attributes">
            <EditItemTemplate>
                <asp:CheckBoxList ID="cblAttributes" runat="server" DataSourceID="sqlAttributes" DataValueField="AttributeID" DataTextField="AttributeName" RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Table" CellPadding="2" CellSpacing="2" Width="1000" CssClass="the300" /></EditItemTemplate>
        </asp:TemplateField>
        <asp:CommandField HeaderText="Action" ShowEditButton="True" ShowInsertButton="true" UpdateText="Save Changes" ShowCancelButton="true" ButtonType="Button" ControlStyle-CssClass = "button" />
    </Fields>                               
</asp:DetailsView>
4

0 に答える 0