Move form data out of event handlers

H

Hillbilly

Right now I have a shitload of form data [1] in an event handler I will need
to reuse in other event handlers in the same page. Using firstName1 and
firstName2 for strings can't possibly be the way I should be coding this
type of task not to mention its tedious as all get out. What's a workable
way to move the initialization out of the event handler and into the class
or wherever so the data in the form can be used by different event handlers
in page?

Similarly, how is this objective done with a separate class whose members
are initialized with data from some form the class is designed to manage in
this context? Is this what public properties of a class are for? A generic
example to see the pattern or reference to a design pattern is what I need
help with here please... Don't want to write OOP as if it were ASP.

[1] example generic form data
string firstName = FirstNameTextBox.Text;
string lastName = LastNameTextBox.Text;
string city = CityTextBox.Text;
....
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top