public void myBoxesTextBox_TextChanged(object sender, EventArgs e)
{
Button btnSender = (Button)sender;
string txtID = btnSender.ID.Replace("btn", "txt");
TextBox senderBox = (TextBox)FindControl(txtID);
string officeID = senderBox.ID;
officeID = officeID.Replace("txt", "");
officeID = officeID.Replace("Boxes", "");
int counter = 0;
int indexToChange = -1;
string Office = "";
foreach (KeyValuePair<string, int> currentKVP in boxData)
{
if (currentKVP.Key.ToString() == officeID)
{
indexToChange = counter;
Office = currentKVP.Key.ToString();
}
counter++;
}
if (indexToChange != -1)
{
if (int.Parse(senderBox.Text) == 0)
{
boxData.RemoveAt(indexToChange);
}
else
{
boxData[indexToChange] = new KeyValuePair<string, int>(Office, int.Parse(senderBox.Text));
}
}
Presenter.UpdateRecord();
txtBoxLocation.Text = "";
txtNumberOfBoxes.Text = "";
Presenter.GetRecordById(Request.QueryString["ID"]);
DrawBoxDetails();
}