How do I make GetCaseButton work when clicked?
-
I have a new web app that is based on an old desktop app. I need help on how to make changes to old GetCaseButton_Click desktop app code and make it work for new web app. The old code is using Combobox and MessageBox for error message. In my web app aspx code I am using DropDownList and ClientScript for error message. Is there a better way of displaying error message in web app to replace MessageBox? How do I change Combobox code to DropDownList? The code is very long 200 lines. So I have broken it down to several questions. The GetCaseButton_Click that I need to make changes to so I can use DropDownList instead of Combobox.
private async void GetCasesButton_Click(object sender, EventArgs e)
{
#region Required Field Validation
if (CaseNumbersTextBox.Text.Length < 1)
{
string myStringVariable = "Case number textbox cannot be empty.";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
}ComboboxItem requestorItem = new ComboboxItem(); requestorItem = (ComboboxItem)RequestorComboBox.SelectedItem; ComboboxItem reasonItem = new ComboboxItem(); reasonItem = (ComboboxItem)ReasonComboBox.SelectedItem; if (requestorItem.Value < 1) { MessageBox.Show("Please select a Requestor.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (reasonItem.Value < 1) { MessageBox.Show("Please select a Reason.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endregion #region Parse case number entries string userEnteredCaseNumbers = CaseNumbersTextBox.Text; userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\\r", ","); userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\\n", ","); while (userEnteredCaseNumbers.Contains(",,")) userEnteredCaseNumbers = userEnteredCaseNumbers.Replace(",,", ","); List userEnteredCaseNumberList = new List(); userEnteredCaseNumberList = userEnteredCaseNumbers.Split(',').Where(x => x.Length > 0).ToList(); userEnteredCaseNumberList = userEnteredCaseNumberList.Select(s => s.