Okay so I'm adapting a C# program to an asp program and I have a main form which contains a list box and another which adds new information to the list box. I can fill in the 2nd form and hold values in Application["getData"];
but when I go to the other page I need to run the following code.
public void AddGig()
{
AddGigForm frm = new AddGigForm();
if (Application["getData"] != null)
{
Application["saveData"] = Application["getData"];
gigList.addGig(frm.GetData());
UpdateListbox();
}
I run into problems at gigList.addGig
as it goes back to the method GetData()
on the 2nd form. I just have no idea what else to use.
GetData method:
public GigOpportunity GetData()
{
Application["GetData"] = new GigOpportunity
(txtId.Text, gigDate.SelectedDate, txtVenue.Text, txtGenre.Text,
Convert.ToDouble(txtCost.Text), Convert.ToInt32(txtCapacity.Text), chkHeadliner.Checked, txtMainAct.Text, chkEngineer.Checked);
return new GigOpportunity(txtId.Text, gigDate.SelectedDate, txtVenue.Text, txtGenre.Text, Convert.ToDouble(txtCost.Text), Convert.ToInt32(txtCapacity.Text), chkHeadliner.Checked, txtMainAct.Text, chkEngineer.Checked);
}
addGig method:
public void addGig(GigOpportunity gigOpportunity)
{
//Make sure a gig with this id does not already exist
foreach (GigOpportunity g in gigList)
{
if (g.GigId == gigOpportunity.GigId)
{
throw new DuplicateIdException();
}
}
gigList.Add(gigOpportunity);
}