Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I make GetCaseButton work when clicked?

How do I make GetCaseButton work when clicked?

Scheduled Pinned Locked Moved ASP.NET
helpquestiontutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11369001
    wrote on last edited by
    #1

    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.
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups