modalpop 在更新面板内不起作用

发布于 2024-11-07 16:37:30 字数 1801 浏览 4 评论 0原文

在我的 webform 中。我在更新面板中有 listview 和占位符。我必须弹出一个窗口,显示所选项目的详细信息。我正在 listview item_command 上动态创建弹出窗口。 updatepanel 在 listview item_command 上有异步触发器。

早些时候,我使用面板作为模态弹出窗口。我将面板保留在更新面板内。我必须将值传递给 iframe。但是窗口正在显示,但 iframe src 没有显示。所以我动态创建了窗口。

这是我的代码。

protected void OrderList_ItemCommand(object sender, ListViewCommandEventArgs e)
{
     switch (e.CommandName)
     {
        case "ViewOrderDetails":
        ListViewDataItem currentItem = (ListViewDataItem)e.Item;
        DataKey currentDataKey = this.OrderList.DataKeys[currentItem.DisplayIndex];
        string Orderid = Convert.ToString(currentDataKey["Order_Id"]);
        Createpopwindow(Orderid );
        Break;
     }
}

private void Createpopwindow(string contestid)
{
    popupholder.Controls.Clear();

    Panel popuppanel = new Panel();
    popuppanel.ID = "poppanel1";
    popuppanel.Width=550;
    popuppanel.CssClass = "Dialoguebox";

    HtmlGenericControl popupbody = new HtmlGenericControl("p");
    ImageButton closebtn = new ImageButton();
    closebtn.ID="panelclose";
    closebtn.ImageUrl="~/images/close01.png";
    HtmlGenericControl frame = new HtmlGenericControl("iframe");
    frame.Attributes.Add("width","100%");
    frame.Attributes.Add("src", "joincontest.aspx?contest=" + contestid);

    popupbody.Controls.Add(closebtn);

    popuppanel.Controls.Add(popupbody);
    popuppanel.Controls.Add(frame);
    popupholder.Controls.Add(popuppanel);


    //creating modal popup extender

    ModalPopupExtender Popup = new ModalPopupExtender();
    Popup.ID = "popupextender";
    Popup.TargetControlID = "Button1";
    Popup.PopupControlID = "poppanel1";
    Popup.CancelControlID = "panelclose";
    this.Page.Controls.Add(Popup);

    Popup.Show();
}

但选择列表视图项目时不显示弹出窗口。 我错过了什么吗?

in my webform.i have listview and a placeholder inside a update panel.i have to popup a window showing details of selected item.i am dynamically creating popup on listview item_command.
updatepanel has asynchronous trigger on listview item_command.

earlier i was using panel as modal popupwindow.i kept panel inside the update panel.i have to pass value to iframe.but the window was displaying but the iframe src was not displaying.so i created the window dynamically.

here is my code.

protected void OrderList_ItemCommand(object sender, ListViewCommandEventArgs e)
{
     switch (e.CommandName)
     {
        case "ViewOrderDetails":
        ListViewDataItem currentItem = (ListViewDataItem)e.Item;
        DataKey currentDataKey = this.OrderList.DataKeys[currentItem.DisplayIndex];
        string Orderid = Convert.ToString(currentDataKey["Order_Id"]);
        Createpopwindow(Orderid );
        Break;
     }
}

private void Createpopwindow(string contestid)
{
    popupholder.Controls.Clear();

    Panel popuppanel = new Panel();
    popuppanel.ID = "poppanel1";
    popuppanel.Width=550;
    popuppanel.CssClass = "Dialoguebox";

    HtmlGenericControl popupbody = new HtmlGenericControl("p");
    ImageButton closebtn = new ImageButton();
    closebtn.ID="panelclose";
    closebtn.ImageUrl="~/images/close01.png";
    HtmlGenericControl frame = new HtmlGenericControl("iframe");
    frame.Attributes.Add("width","100%");
    frame.Attributes.Add("src", "joincontest.aspx?contest=" + contestid);

    popupbody.Controls.Add(closebtn);

    popuppanel.Controls.Add(popupbody);
    popuppanel.Controls.Add(frame);
    popupholder.Controls.Add(popuppanel);


    //creating modal popup extender

    ModalPopupExtender Popup = new ModalPopupExtender();
    Popup.ID = "popupextender";
    Popup.TargetControlID = "Button1";
    Popup.PopupControlID = "poppanel1";
    Popup.CancelControlID = "panelclose";
    this.Page.Controls.Add(Popup);

    Popup.Show();
}

but the popup is not showing on selecting the listview item.
did i missed any thing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满地尘埃落定 2024-11-14 16:37:30

您动态创建这个而不是在标记中是否有原因?
如果您在标记中创建模态弹出窗口,您仍然可以在显示之前动态设置所有值。

Is there a reason you are creating this dynamically, and not in your markup?
If you create your modalpopup in the markup, you can still set all the values dynamically, before you show it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文