locked
Best way for modal popup? RRS feed

  • Question

  • I have developed search web part(Visual web part) in share point 2010.whenever click on search button records displayed in grid view.grid view contain one hyperlink column,whenever I click hyperlink modal popup will be open

    I need that one,which is the best way 2 done that one

    Thursday, June 16, 2011 11:27 AM

Answers

  • Hi Ravi,

    I successfully used Ajaxcontrol toolkit's modalpopup extender for similar kind of requirement.

    Add all your popup code in a div and call it from modalpopup extender. Thats the easiest way.

    For Ajaxcontrol toolkit to work with SharePoint 2010, use this: http://ranaictiu-technicalblog.blogspot.com/2010/08/ajax-control-toolkit-with-sharepoint.html

     

    You can also use jquery for doing the same.

    • Marked as answer by Porter Wang Monday, June 20, 2011 2:18 AM
    Thursday, June 16, 2011 12:20 PM
  • Hi Ravi, Since you are using Sharepoint 2010 try to utilize the features of Sharepoint Modal Dialog.

    SP.UI.ModalDailog meets your requirements.

    http://msdn.microsoft.com/en-us/library/ff410058.aspx

    <script>
    function OpenDialog(url) {
      var options = SP.UI.$create_DialogOptions();
      options.url = url;
      options.title = 'Backhaul Contract'; 
      
      options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
      SP.UI.ModalDialog.showModalDialog(options);
     }
    
     function CloseCallback(result, target) {
      //SP.UI.Notify.addNotification('Operation Successful!');
    //use this line to refresh the page on close of the Modal Dialogue
      window.location.reload();
     }</script>
    
    <a onclick="OpenDialog('http://server/_layouts/custom.aspx')"> Test</a>
    
    

    Hope that helps :)


    Sreeharsha Alagani | MCTS Sharepoint 2010 | Linkedin | Blog
    • Marked as answer by Porter Wang Monday, June 20, 2011 2:18 AM
    Thursday, June 16, 2011 1:30 PM

All replies

  • Hi Ravi,

    I successfully used Ajaxcontrol toolkit's modalpopup extender for similar kind of requirement.

    Add all your popup code in a div and call it from modalpopup extender. Thats the easiest way.

    For Ajaxcontrol toolkit to work with SharePoint 2010, use this: http://ranaictiu-technicalblog.blogspot.com/2010/08/ajax-control-toolkit-with-sharepoint.html

     

    You can also use jquery for doing the same.

    • Marked as answer by Porter Wang Monday, June 20, 2011 2:18 AM
    Thursday, June 16, 2011 12:20 PM
  • Hi Ravi, Since you are using Sharepoint 2010 try to utilize the features of Sharepoint Modal Dialog.

    SP.UI.ModalDailog meets your requirements.

    http://msdn.microsoft.com/en-us/library/ff410058.aspx

    <script>
    function OpenDialog(url) {
      var options = SP.UI.$create_DialogOptions();
      options.url = url;
      options.title = 'Backhaul Contract'; 
      
      options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
      SP.UI.ModalDialog.showModalDialog(options);
     }
    
     function CloseCallback(result, target) {
      //SP.UI.Notify.addNotification('Operation Successful!');
    //use this line to refresh the page on close of the Modal Dialogue
      window.location.reload();
     }</script>
    
    <a onclick="OpenDialog('http://server/_layouts/custom.aspx')"> Test</a>
    
    

    Hope that helps :)


    Sreeharsha Alagani | MCTS Sharepoint 2010 | Linkedin | Blog
    • Marked as answer by Porter Wang Monday, June 20, 2011 2:18 AM
    Thursday, June 16, 2011 1:30 PM