modalpop 在更新面板内不起作用
在我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您动态创建这个而不是在标记中是否有原因?
如果您在标记中创建模态弹出窗口,您仍然可以在显示之前动态设置所有值。
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.