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. My web app aspx code is using DropDownList and ClientScript for error message.
How do I change Combobox code to DropDownList?
The code is very long 200 lines. So I have broken it down to several questions. After this question is answered and I am able to do this part, I will post next question.
Thanks in advance and happy new year 2020.
What I have tried:
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<string> userEnteredCaseNumberList = new List<string>();
userEnteredCaseNumberList = userEnteredCaseNumbers.Split(',').Where(x => x.Length > 0).ToList();
userEnteredCaseNumberList = userEnteredCaseNumberList.Select(s => s.Trim()).ToList();
#endregion
}