完全に機能する ModalPopupExtender 内に詳細ビューがあります。詳細ビューのフッター テンプレート セクションに、いくつかのリンク ボタンを配置しました。
リンクボタンが押されると、動的に作成される CollapsiblePanelExtender がトリガーされます。これまでのところ、すべてが正常に機能しています。以下は、モーダルポップアップ内の詳細ビューの一部です
<Toolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlPopUp" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="DragHandle" DropShadow="true"/>
<asp:Panel ID="pnlPopUp" runat="server" style="display:none;"
CssClass="popUpStyle">
<asp:Panel ID="DragHandle" runat="server" CssClass="drag" ></asp:Panel>
<asp:DetailsView ID="dvwDetailsUser" runat="server"
AutoGenerateRows="False"
Width="100%"
onitemcommand="dvwDetailsUser_ItemCommand"
FooterStyle-HorizontalAlign="Right"
ForeColor="#990000"
BorderWidth="0px" >
<Fields>
<asp:BoundField DataField="GivenName" HeaderText="First name" />
<asp:BoundField DataField="SurName" HeaderText="Last name" />
<asp:BoundField DataField="DisplayName" HeaderText="DisplayName" />
<asp:BoundField DataField="SamAccountName" HeaderText="Account" />
<asp:BoundField DataField="EmailAddress" HeaderText="E-mail" />
<asp:CheckBoxField DataField="Enabled" HeaderText="user enabled" />
<asp:BoundField NullDisplayText="" />
<asp:BoundField DataField="DistinguishedName"
HeaderText="DistinguishedName" />
</Fields>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate >
<asp:LinkButton ID="btnProperties"
runat="server" CommandName="Remove" Text="Remove" />
</FooterTemplate>
<HeaderStyle BackColor="#FFCD4A" Font-Bold="True"
HorizontalAlign="left" />
<AlternatingRowStyle BackColor="#EFEFEF" />
</asp:DetailsView>
</asp:Panel>
modalpopup エクステンダーと詳細ビューは、updatepanel 内にラップされます。ポップアップ ウィンドウ内のリンク ボタンを押すと、折りたたみ可能なパネルが表示されます。
折りたたみ可能なパネル内には、ボタンも動的に作成されています。ボタンを押すと、ボタンに添付された新しいイベントハンドラが起動されません。
protected void dvwDetailsUser_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
if (e.CommandName == "Remove")
DeleteAccount();
end if
}
public void DeleteAccount()
{
Panel p = new Panel();
Button btnRemove = new Button();
p.ID = "pnlDeleteAccount";
p.GroupingText = "Remove" + dvwDetailsUser.Rows[2].Cells[1].Text;
btnRemove.Text = "Remove"
btnRemove.ID = "Apply";
btnRemove.CausesValidation = false;
btnRemove.UseSubmitBehavior = false;
btnRemove.Click += new EventHandler(btnRemove_Click);
p.Controls.Add(btnRemove);
CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
cpe.TargetControlID = p.UniqueID;
cpe.ExpandControlID = p.UniqueID;
cpe.CollapseControlID = p.UniqueID;
cpe.AutoCollapse = false;
cpe.AutoExpand = false;
cpe.ScrollContents = false;
cpe.SuppressPostBack = false;
cpe.ExpandDirection = CollapsiblePanelExpandDirection.Vertical;
cpe.Page = this.Page;
pnlPopUp.Controls.Add(cpe);
cpe.Controls.Add(p);
mdlPopup.Show();
}
public void btnRemove_Click(object sender, EventArgs e)
{
Response.Redirect("UserAccount.aspx");
}
削除ボタンが押されたときにイベント btnRemove_click が発生するかどうかを確認するために、response.redirect を配置しました。
ここで何か不足していますか?