Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6750819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:51:13+00:00 2026-05-26T12:51:13+00:00

So i have a table that is built dynamically that adds rows for each

  • 0

So i have a table that is built dynamically that adds rows for each machine in the database. Each row contains 4 columns and With 2 of the columns added to the table they contain a RadComboBox that gives the user the ability to select certain values that come from the database.

the method that builds each row for the table

        private void AddNewRow1(Machine Machine)
    {
        //start a new row
        TableCell site = new TableCell();
        TableCell name = new TableCell();
        TableCell type = new TableCell();
        TableCell model = new TableCell();
        TableRow tr = new TableRow(); 
        Literal breakline = new Literal();
        breakline.Text = "<br />";
        Literal breakline1 = new Literal();
        breakline1.Text = "<br />"; 

        //site name column
        site.RowSpan = 2;
        site.Controls.Add(AddSiteField(Machine));
        tr.Controls.Add(site);

        //machine name
        name.RowSpan = 2;
        name.Controls.Add(AddMachineField(Machine));
        tr.Controls.Add(name);

        //machine type name
        type.RowSpan = 2;
        type.Controls.Add(AddMachineTypeField(Machine));
        type.Controls.Add(breakline);
        type.Controls.Add(AddTypeComboBox());
        tr.Controls.Add(type);

        //machine model name
        model.RowSpan = 2;
        model.Controls.Add(AddMachineModelField(Machine));
        model.Controls.Add(breakline1);
        model.Controls.Add(AddModelComboBox());
        tr.Controls.Add(model);

        AssignPlaceHolder.Controls.Add(tr);
    }

The method in the model and type controls AddModelComboBox() or AddTypeComboBox() is below:

        private RadComboBox AddModelComboBox()
    {
        RadComboBox MachineModelCombo = new RadComboBox();
        machineModel = inputsService.GetMachineModelList(SiteID);
        foreach (MachineModel MachineModel in machineModel)
        {
            if (MachineModel.Name != "NULL")
            {                    
                MachineModelCombo.Items.Add(new RadComboBoxItem(MachineModel.Name, MachineModel.ID));
            }
        }

        MachineModelCombo.EnableLoadOnDemand = true;
        MachineModelCombo.EmptyMessage = "Select a Machine Model";
        return MachineModelCombo;
    }

The table works fine, and is built correctly.
Where i am having my problem in the code below has to do with obtaining the value of these dynamically build comboboxes:

        protected void Update_Click(object sender, EventArgs e)
    {
      string MachineTypeID;
      string MachineModelID;
      machine = inputsService.GetMachineSiteDetails(SiteID);
      foreach (Machine Machine in machine)
      {
          try
          {
              RadComboBox machineTypeComboBox = new RadComboBox();
              RadComboBox machineModelComboBox = new RadComboBox();
              MachineTypeID = machineTypeComboBox.SelectedValue;
              MachineModelID = machineModelComboBox.SelectedValue;
              inputsService.UpdateMachineModels(Machine.ID, MachineTypeID);
              inputsService.UpdateMachineTypes(Machine.ID, MachineModelID);
          }
          catch (Exception ex)
          {
              {
                  logger.ErrorFormat(
                      "Update_Click exception occurred when attempting to update the database {0}", ex);
              }
          }
      }

My question is, how can i get the selected value from a dynamically built radcombobox?

Note:

              inputsService.UpdateMachineModels(Machine.ID, MachineTypeID);
              inputsService.UpdateMachineTypes(Machine.ID, MachineModelID);

these two lines are webservice calls to a DB api to make updates to the database depending on the item selected in the web page. The same goes for any call that starts with inputsService.*

any help or suggestions are greatly appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:51:13+00:00Added an answer on May 26, 2026 at 12:51 pm

    Okay i figured it out, which now after looking at it seemed pretty obvious…lol So i figured i would post it here in case anyone else needs an answer to this question.

    What ended up being the solution to this problem was to give each of the comboboxes it own id.
    This was achieved with the following code below:

    This is the now modified create a new combobox method:

        private RadComboBox AddModelComboBox(Machine machine)
        {
            RadComboBox MachineModelCombo = new RadComboBox();
            machineModel = inputsService.GetMachineModelList(SiteID);
            foreach (MachineModel MachineModel in machineModel)
            {
                if (MachineModel.Name != "NULL")
                {                    
                    MachineModelCombo.Items.Add(new RadComboBoxItem(MachineModel.Name, MachineModel.ID));
                }
            }
    
            MachineModelCombo.ID = machine.ID.ToString() + "model";
            MachineModelCombo.EnableLoadOnDemand = true;
            MachineModelCombo.EmptyMessage = "Select a Machine Model";
            return MachineModelCombo;
        }
    

    Machine goes into the DB and grabs an id for the machine. To make sure that the type and model methods don’t obtain the same id a string was added to the machine id.

    Now to obtain a selected value from a radComboBox i used to following code:

    Note: this is still under development and does not include validations, and catches.

            protected void Update_Click(object sender, EventArgs e)
        {
          string MachineTypeID;
          string MachineModelID;
          machine = inputsService.GetMachineSiteDetails(SiteID);
          foreach (Machine Machine in machine)
          {
              try
              {
                  string machinetypeid = Machine.ID.ToString() + "type";
                  string machinemodelid = Machine.ID.ToString() + "model";
                  Control type = MyExtensions.FindControlRecursive(this, machinetypeid);
                  Control model = MyExtensions.FindControlRecursive(this, machinemodelid);
                  RadComboBox machinetype = (RadComboBox) type;
                  RadComboBox machinemodel = (RadComboBox) model;
                  MachineTypeID = machinetype.SelectedValue;
                  MachineModelID = machinemodel.SelectedValue;
                  inputsService.UpdateMachineModels(Machine.ID, MachineModelID);
                  inputsService.UpdateMachineTypes(Machine.ID, MachineTypeID);
              }
              catch (Exception ex)
              {
                  {
                      logger.ErrorFormat(
                          "Update_Click exception occurred when attempting to update the database {0}", ex);
                  }
              }
          }
          //clear out the old table and replace with the newly revized table.
          AssignPlaceHolder.Controls.Clear();  
          AddTableTitles();
          UpdateTableControls();
        }
    

    Note: The controls in the second method are a method that obtains the dynamically built control by finding it’s id/root in the html and gets the selected value through that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is dynamically built by the database. For each thing
I have a table that is dynamically built using DOM. It has 10 cols,
Group, I have a table that is dynamically built with device ids. I have
I have a table that contains tasks and I want to give these an
I build dynamically my HTML table from database like that: for (i = 0;
I have an AlumniRecords table with 60+ columns. I created an AlumniSearchResults class that
I need to hide/show parts of a table that is dynamically built, as shown
I have a query that is dynamically built after looking up a field list
I have an AdvancedDataGrid being built dynamically from an html table. The html is
I have a table (several actually) that contain a lot of columns (maybe 100+).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.