Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 955
Reply with quote  #1 

Perform Additional Processing When Modal Pop-Up Window Closes

Bryan Patrick –Pseudo Consulting

August 16, 2014

 

Introduction

Iron Speed added an excellent feature in version 11:  The ability to open any window in a modal pop-up window.   This feature also allows the application to automatically update either one record or one table when the pop-up window closes.  Here’s how to perform other processing when the user closes that modal pop-up window.

The Problem

In one of my applications I have “Edit Account” page where I’ve grouped many fields onto different tabs.  One of the tabs contains an “Account Ledger” table of transactions.  The problem is that by default the “Add Record” page for this table redirects to a new browser window.  If the user had updated any field prior to clicking on the “Add  Record” icon those changes will be lost.   Sure, we could have modified the button to save the record before redirecting but I don’t want to save changes unless the user clicks on the “Save” button.

The Solution to the Problem

Along comes Iron Speed version 11 and aha!  They’ve added the ability to open the “Add Record” page in a modal pop-up.  Excellent!  I won’t lose my record changes while I’m adding a new Ledger Transaction.  And after adding the record, the Account Ledger table is updated on the tab.  And this works very well.

1.png 

The ledger table after the “Save” button is clicked in the modal pop-up

2.png 

 

The Problem with the Solution to the Problem

The problem with this is that on the first tab of the user’s record,  I show an “Account Balance” which is the sum of all the user’s transactions.  Updating just the ledger table does not update any other control on the page.  So I needed a way to update both the ledger table and another control when the user adds a record.  Unfortunately, the function that is called by user closing the modal pop-up is declared “Private” so it cannot be modified or overridden in your record or table classes.

3.png   

 

The Solution to the Problem with the Solution to the Problem

We can simply modify the “Postback” function and make it public.  Then with a couple of lines of code, we can perform other functions when a modal pop-up window closes.

Open the \shared\BaseApplicationRecordControl.cs and scroll to the bottom of the file.  Change the Postback function to be public virtual.  This is the function that handles updating a record control when a pop-up window closes.

4.png 

Do the same with \shared\BaseApplicationTableControl.cs.   This is the function that handles updating a table control when a pop-up window closes.

 

Then it’s just a matter of adding the override code to your record or table class.  In my case, the table class for the ledger is “OnlineLedgerViewTable”.    In the overridden function, I call the base function (to update the ledger table itself).  I then locate the record control on the page that is displaying the Account Balance and set its “DataChanged” to true, which will cause it to also be updated.

5.png 

Now the numbers on the “General” tab are updated whenever a ledger entry is added.  No other fields are updated/overwritten.

6.png 

The Warning

Modifications to the “baseclasses” will get overwritten the next time you migrate your application to a newer version of Iron Speed.

Conclusion

With a little modification to the base classes it’s possible to perform additional processing when the user closes a modal pop-up window in an Iron Speed application.  In this example I’m just updating some other information on the same underlying page.  You can perform any processing you want.

Hopefully in the future, the base classes will define “Postback” as public so they can be overridden without having to modify anything.  

About the Author

C. Bryan Patrick II has been a professional database developer since the age of 16.  He has a Bachelor of Arts in Computer Science from The University of Texas at Austin.  At 26 Bryan received a US Patent (# 5,142,624) for work done during his college years.  He is a member of the Microsoft Partner Program and has been self-employed for the last 14 years as a web application developer.



__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
janthony

Registered:
Posts: 136
Reply with quote  #2 
Bryan,

Thanks for sharing.

Jim
timt

Avatar / Picture

Iron Speed MVP
Registered:
Posts: 556
Reply with quote  #3 
Hi Bryan

Thanks for that, nice one. Can the folks at Iron Speed make these public? would be good

Thanks
Tim

__________________
Tim Titchmarsh Iron Speed Consultant MVP
London UK based
+44 (0)1621 835002
http://www.lightspeeditsolutions.co.uk/dotnetarchitect
timt@dotnetarchitect.co.uk
timt@lsits.co.uk
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 955
Reply with quote  #4 
Thanks Tim.

I asked.

Hopefully in a later version they will make it public.

And I think it would make a really easy and excellent Code Customization Wizard entry.

CCW:  "Perform Additional Processing When Modal Pop-Up Window Closes"


__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
timt

Avatar / Picture

Iron Speed MVP
Registered:
Posts: 556
Reply with quote  #5 
Hi Bryan

I think the code base needs a revisit to make it more code generation/user changeable friendly. A lot has happened in the last few years and Microsoft has tailored a lot of the language and structure to accommodate its own code building needs - why not leverage that to the full?

Cheers
Tim

__________________
Tim Titchmarsh Iron Speed Consultant MVP
London UK based
+44 (0)1621 835002
http://www.lightspeeditsolutions.co.uk/dotnetarchitect
timt@dotnetarchitect.co.uk
timt@lsits.co.uk
Gerard

Registered:
Posts: 588
Reply with quote  #6 
I would add to Tims comments
I know a lot of work is going on behind the scenes to add mobile and deal with mobile.
But some of it is starting to look klunky especially Grid controls and having to deal with many extra pages ADD - edit Show for standard and Mobile when you can buy of the shelf grids that do the lot and work for touch - IPad etc as well.

I have a project that will probably require a grid like telerik asp.net grid which can drag and drop items on to it and reorder & resize columns on the fly and go across many devices.
 Gerard

miles

Avatar / Picture

MVP Consultant
Registered:
Posts: 1,659
Reply with quote  #7 
+1 on a revamp of the base classes.  Although they work fairly well, there are lots of areas for improvement.  Maybe we need to start listing the areas that we would like improved, such as dynamic connection string management, over-ride methods, extensions etc.

I think the point is that most people don't even know what/where the baseclasses are -- however for advanced users this is a critical pain point area.

I also think its time to include the base classes as source code as part of the solution, and provide a mechanism to protect changes through migration etc. I realize that means keeping two code bases (one for vb and 1 for C#), but it certainly would make Iron Speed more developer friendly.

FWIW, M2CW

__________________
Miles Gibson, MScIS
Iron Speed MVP
Senior Consultant, Principal
Milestone Software Inc.

http://www.ironspeedmvp.com\localizer 
Email: miles@milestone.ca
Milestone Localizer: Full Localization for your Iron Speed applications!
porphi

Registered:
Posts: 647
Reply with quote  #8 
Miles,

Quote:
I also think its time to include the base classes as source code as part of the solution, and provide a mechanism to protect changes through migration etc. I realize that means keeping two code bases (one for vb and 1 for C#), but it certainly would make Iron Speed more developer friendly.


Source code for the base classes are included with the installation of ISD.  I've included them in projects in the past for debugging purposes.

__________________
Thank you,
Phil Porter
PPG&A, INC.
pporter@ppgainc.com
http://www.ppgainc.com
https://rapidsprout.com
678-362-2035
miles

Avatar / Picture

MVP Consultant
Registered:
Posts: 1,659
Reply with quote  #9 
Phil:

Quote:
Source code for the base classes are included with the installation of ISD.  I've included them in projects in the past for debugging purposes. 


Yes, I am aware that the source is included, but it is not a seamless process to have to continually patch the base classes every time a new version is released.  There must be a better way...

__________________
Miles Gibson, MScIS
Iron Speed MVP
Senior Consultant, Principal
Milestone Software Inc.

http://www.ironspeedmvp.com\localizer 
Email: miles@milestone.ca
Milestone Localizer: Full Localization for your Iron Speed applications!
JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,954
Reply with quote  #10 
Thanks Bryan!
__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

pmodiano

Avatar / Picture

MVP Consultant
Registered:
Posts: 62
Reply with quote  #11 
Nice one, Bryan.  That will save me some time now that I am only now getting to work with 11.

Paul.

__________________
Paul Modiano
Logical Developers, LLC.
t. 212-929-6940
f. 212-504-8013
pmodiano@logicaldevelopers.com
http://www.logicaldevelopers.com
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 955
Reply with quote  #12 

Good deal Paul.

Now you get to go to 11 like Nigel Tufnel.




__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
rawales2

Registered:
Posts: 96
Reply with quote  #13 
This is a great tutorial. I'd looked at it a few times and finally implemented today. Well done.
__________________
Rob
You can code your own way...
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement