Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

XML
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

XML
<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
XML
<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>
Posted

1 solution

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

XML
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.
 
Share this answer
 
v3
Comments
pinky1810 6-Jun-13 6:31am    
Sorry Didn't work, Actually the problem is not with my code,there is some jquery error.
i am not getting any error when i click on view,its just breaking somewhere and the popup is not opening.when i debug it shows like modalpopupextender.cs does't not exist.

please advice

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900