点击链接按钮,在modalpopup中打开asp.net页面 [英] Opening asp.net page in modalpopup on click of link button

查看:58
本文介绍了点击链接按钮,在modalpopup中打开asp.net页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在单击链接按钮时在moodalpopup扩展器中打开另一个asp.net页面,

链接按钮在网格中。我可以看到当我点击链接按钮时的进度但没有弹出模态。请指教。



我正在使用此代码



 protected void Gvwcustomer_RowCommand(对象发送者,GridViewCommandEventArgs e)
{
if(e.CommandName ==view)
{
GridViewRow row =(GridViewRow)(((LinkBut​​ton)e。 CommandSource).NamingContainer);
Label lblempId =(Label)row.Cells [0] .FindControl(lblempId);
string Employee_Id = lblempId.Text;

Response.Write(< script language = javascript > var params = ['height ='+ screen.height,'width ='+ screen.width,'fullscreen = no','status = no','resizable = yes','scrollbars = yes']。join(','); var popup = window.open('ViewEmployeeReport.aspx?empid =+ Employee_Id +','_ blank',params) ; popup.moveTo(0,0); < / script > );


}

}







,这是脚本



 <   script     type   =  text / javascript >  
//要显示处理进度
var prm = Sys.WebForms.PageRequestManager.getInstance();
//在处理异步回发开始之前引发并将回发请求发送到服务器。
prm.add_beginRequest(BeginRequestHandler);
//异步回发完成并且控件返回浏览器后引发。
prm.add_endRequest(EndRequestHandler);
函数BeginRequestHandler(sender,args){
//显示模态弹出窗口 - 更新进度
var popup = $ find('<% = ProgressModalPopup.ClientID %> ');
if(popup!= null){
popup.show();
}
}

函数EndRequestHandler(sender,args){
//隐藏模态弹出窗口 - 更新进度
var popup = $ find( '<% = ProgressModalPopup.ClientID %> ');
if(popup!= null){
popup.hide();
}
}
< / script >



这是asp控件

 < span class =code-keyword><   asp:UpdateProgress     ID   =  UpdateProgress    runat   =  server  >  
< ProgressTemplate >
< asp:Image ID = Image1 ImageUrl = 〜 /images/loading.gif\" AlternateText = 处理

runat = server 高度 = 25px / >
< / ProgressTemplate >
< < span class =code-leadattribute> / asp:UpdateProgress >
< asp:ModalPopupExtender ID = ProgressModalPopup runat = server TargetControlID = UpdateProgress

PopupControlID = UpdateProgress BackgroundCssClass = modalBackground / >
< / ContentTemplate >

解决方案

find('<% = ProgressModalPopup.ClientID %> ') ;
if(popup!= null){
popup.show();
}
}

函数EndRequestHandler(sender,args){
//隐藏模态弹出窗口 - 更新进度
var popup =

find('<% = ProgressModalPopup.ClientID %> ' );
if(popup!= null){
popup.hide();
}
}
< / script >



这是asp控件

 < span class =code-keyword><   asp:UpdateProgress     ID   =  UpdateProgress    runat   =  server  >  
< ProgressTemplate >
< asp:Image ID = Image1 ImageUrl = 〜 /images/loading.gif\" AlternateText = 处理

runat = server 高度 = 25px / >
< / ProgressTemplate >
< < span class =code-leadattribute> / asp:UpdateProgress >
< asp:ModalPopupExtender ID = ProgressModalPopup runat = server TargetControlID = UpdateProgress

PopupControlID = UpdateProgress BackgroundCssClass = modalBackground / >
< / ContentTemplate >


尝试在gridview的rowbound事件上绑定脚本,例如:



 protected void CustomersGridView_RowDataBound(Object sender,GridViewRowEventArgs e)
{

if(e.Row.RowType == DataControlRowType.DataRow)
{
//注册javascript。
e.Row.Cells [你的链接按钮单元格号] .SetAttribute(onclick,你的脚本打开模态弹出窗口);

}

}





这将解决您的问题。


I am trying top open another asp.net page in moodalpopup extender on click of link button,
the link button is there in the grid .i can see the progress when i click on link button but no modal pop up . please advise.

I am using this code

protected void Gvwcustomer_RowCommand(object sender, GridViewCommandEventArgs e)
   {
       if (e.CommandName == "view")
       {
           GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
           Label lblempId = (Label)row.Cells[0].FindControl("lblempId");
           string Employee_Id = lblempId.Text;
          
           Response.Write("<script language=javascript>var params = ['height='+screen.height,'width='+screen.width,'fullscreen=no','status=no','resizable=yes','scrollbars=yes'].join(','); var popup=window.open('ViewEmployeeReport.aspx?empid=" + Employee_Id + "','_blank',params);popup.moveTo(0,0);</script>");
          

       }

   }




and this is the script

<script type="text/javascript">
           //To show Processing progress
           var prm = Sys.WebForms.PageRequestManager.getInstance();
           //Raised before processing of an asynchronous postback starts and the postback request is sent to the server.
           prm.add_beginRequest(BeginRequestHandler);
           // Raised after an asynchronous postback is finished and control has been returned to the browser.
           prm.add_endRequest(EndRequestHandler);
           function BeginRequestHandler(sender, args) {
           //Shows the modal popup - the update progress
               var popup = $find('<%= ProgressModalPopup.ClientID %>');
               if (popup != null) {
                   popup.show();
               }
           }

           function EndRequestHandler(sender, args) {
               //Hide the modal popup - the update progress
               var popup = $find('<%= ProgressModalPopup.ClientID %>');
               if (popup != null) {
                   popup.hide();
               }
           }
     </script>


and this is the asp controls

<asp:UpdateProgress ID="UpdateProgress" runat="server">
          <ProgressTemplate>
              <asp:Image ID="Image1" ImageUrl="~/images/loading.gif" AlternateText="Processing"

                  runat="server" Height="25px" />
          </ProgressTemplate>
      </asp:UpdateProgress>
      <asp:ModalPopupExtender ID="ProgressModalPopup" runat="server" TargetControlID="UpdateProgress"

          PopupControlID="UpdateProgress" BackgroundCssClass="modalBackground" />
      </ContentTemplate>

解决方案

find('<%= ProgressModalPopup.ClientID %>'); if (popup != null) { popup.show(); } } function EndRequestHandler(sender, args) { //Hide the modal popup - the update progress var popup =


find('<%= ProgressModalPopup.ClientID %>'); if (popup != null) { popup.hide(); } } </script>


and this is the asp controls

<asp:UpdateProgress ID="UpdateProgress" runat="server">
          <ProgressTemplate>
              <asp:Image ID="Image1" ImageUrl="~/images/loading.gif" AlternateText="Processing"

                  runat="server" Height="25px" />
          </ProgressTemplate>
      </asp:UpdateProgress>
      <asp:ModalPopupExtender ID="ProgressModalPopup" runat="server" TargetControlID="UpdateProgress"

          PopupControlID="UpdateProgress" BackgroundCssClass="modalBackground" />
      </ContentTemplate>


try binding your script on rowbound event of gridview something like:

protected void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{

    if(e.Row.RowType == DataControlRowType.DataRow)
    {
      // Registering javascript.
      e.Row.Cells[your link button cell number].SetAttribute("onclick",your script to open modal popup);

    }

}



this will solve your problem.


这篇关于点击链接按钮,在modalpopup中打开asp.net页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆