Help with automating javascript, modal popup, wiring up buttons

I have a main page that has a list of records.  On the page are Add, Edit and View buttons which when clicked, invoke javascript and display modal popups that allow for adding new record, editing an existing record, or viewing an existing record.  The Add and Edit modal popups have Save and Cancel buttons.  The View popup just has a Close button.  For the Save and Cancel buttons I also have javascript that passes back a value via window.returnValue.

I do this for each app/set pf pages I create.  I want to somehow try to automate this process.  I have to copy and paste all the javascript, wiring up the buttons, etc.   The only thing that is different each time is the name of all the pages, i.e., the main page, the add page, the edit page and the view page, and these names in the corresponding javascript.

Any thoughts on how to automate this?
LVL 1
HLRosenbergerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
You might look into T4 templates. You can write up a template script that you can use a built-in transformation tool to generate code items (or really any text file). This is actually how Entity Framework generates its entity classes once you set up the connection to the database.

Once you have created your script, you could then package it up as an "Add New Item" entry. To do that, you would need to export it. You would use the File->Export Template menu option to do this. Once you export it, you will have a self-contained unit that you could then distribute among your peers.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HLRosenbergerAuthor Commented:
ok, I'm looking at the write-up.   So, it will generate any text?   can I somehow pass it the names of the forms and buttons that I have to create and wire-up?
0
HLRosenbergerAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.