locked
Create new Pop-up window when clicking add/edit button on a Grid LS 2011 RRS feed

  • Question

  • Hello, I have a search screen which shows the results in a Data grid and I want to insert the add/edit command so when you click on it, the pop-up window shows up.  The only thing is I do not want to use the Default pop-up window  but instead open my CreateScreen I customized myself.  Is there a way to do this?

    Thanks for the help

    Friday, May 17, 2013 2:45 AM

All replies

  • I think a "Simple" answer is to re-create your custom new screen as a modal window, then automate its opening when you click the add button.

    The modal window opening is discussed here:

    How to programmatically bring up the Modal Window Picker?

    Good luck!


    Would someone please turn on the LIGHT?

    • Proposed as answer by Angie Xu Tuesday, June 4, 2013 2:20 AM
    • Marked as answer by Angie Xu Wednesday, June 5, 2013 11:57 PM
    • Unmarked as answer by Dbdmora Wednesday, June 26, 2013 3:49 AM
    Wednesday, May 22, 2013 2:03 PM
  • Hi, I tried to follow the article above but I still cannot get it right.  I created a new screen called NYScreen and made it the modal window.  When I click on the Add button and click on override code and insert the following:

        partial void ArticleClientQueryAddNew_Execute()
            {
                NYScreen nyscreen = this.NYScreen.AddNew();
                this.OpenModalWindow("NYScreen2", nyscreen);
    
            }

    It says it is invalid, what am I doing wrong??

    Thanks

    Wednesday, June 26, 2013 3:49 AM
  • Hello. It sounds like you want to create a custom modal window, not a modal window picker. The custom modal window requires the addition of a helper class and a bit of screen code. See: 

    Improved Modal Window Helper Class (based on Sheel's Article "Creating a Custom Add Or Edit Dialog"

    This takes a little time to sort through but it is essential stuff.


    4tuneate

    Wednesday, June 26, 2013 5:41 AM
  • Well I followed this website

    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/33/LightSwitch-ndash-Modal-Add-and-Edit-Windows.aspx

    I was able to add the Modal Window by entering this code to a new Add Button and overrode the code.

            partial void ArticleClientQueryAddNew_Execute()
            {
                this.OpenModalWindow("ArticleAdd");
            }
    

    I am able to open the modal Window but everything is greyed Out.  I tried to initialize but everything I tried kept saying not an object or it wasn't a property.  Here is the full code, how do I initialize it so that I can add to the fields of my modal window?  Thanks for the help.

     
    using System;
    using System.Linq;
    using System.IO;
    using System.IO.IsolatedStorage;
    using System.Collections.Generic;
    using Microsoft.LightSwitch;
    using Microsoft.LightSwitch.Framework.Client;
    using Microsoft.LightSwitch.Presentation;
    using Microsoft.LightSwitch.Presentation.Extensions;
    namespace LightSwitchApplication
    {
        public partial class ClientDetails
        {
            //code to show grid on Clients Details page.       
            partial void SelectArticles_Changed()
            {
                this.FindControl("Articles").IsVisible = SelectArticles.Equals(true);
            }
    
            partial void SelectBlogs_Changed()
            {
                this.FindControl("Blogs").IsVisible = SelectBlogs.Equals(true);
            }
    
            partial void selectPR_Changed()
            {
                this.FindControl("PressReleases").IsVisible = selectPR.Equals(true);
            }
    
    
            partial void ArticleClientQueryAddNew_CanExecute(ref bool result)
            {
                // Write your code here.
    
            }
    
            partial void ArticleClientQueryAddNew_Execute()
            {
                this.OpenModalWindow("ArticleAdd");
    
            }
    
            
        }
    }

    Thursday, June 27, 2013 1:45 AM