title: How to update dynamic table rows in .net updatepanel?
body: <p>I have an updatepanel that stores a table.  The table dynamically generates rows of input elements for various property fields:</p>
  
  <pre><code>foreach (DataRow propertyRowToDraw in temporaryTableOfProperties.Rows)
      {
          // Create the property row
          TableRow propertyRow = new TableRow();
  
          // Create the first cell, and give it a value of the property ID, but don't display it
          TableCell propertyIDColumn = new TableCell();
          propertyIDColumn.Text = propertyRowToDraw["PropertyId"].ToString();
          propertyIDColumn.Visible = false;
          propertyRow.Cells.Add(propertyIDColumn);
  
          // Create the second cell and give it a value of the text, or prompt, for that property
          TableCell propertyNameColumn = new TableCell();
          propertyNameColumn.ID = "propertyName" + propertyRowToDraw["PropertyId"].ToString();
          propertyNameColumn.Text = propertyRowToDraw["Prompt"].ToString();
          propertyNameColumn.Width = Unit.Percentage(15);
          propertyRow.Cells.Add(propertyNameColumn);
  
  
          // Not sure what this does
          TableCell propertyHiddenValuesColumn = new TableCell();
          propertyHiddenValuesColumn.ID = "hiddenValues" + propertyRowToDraw["PropertyId"].ToString();
          propertyHiddenValuesColumn.Attributes.CssStyle.Add("display", "none");
          HiddenField hiddenPropertyDataType = new HiddenField();
          hiddenPropertyDataType.Value = propertyRowToDraw["DataType"].ToString();
          propertyHiddenValuesColumn.Controls.Add(hiddenPropertyDataType);
          propertyRow.Cells.Add(propertyHiddenValuesColumn);
  
          // Create a new cell for the property data type
          TableCell propertyDataTypeColumn = new TableCell();
          propertyDataTypeColumn.ID = "propertyDataType" + propertyRowToDraw["PropertyId"].ToString();
  
          // Create a dropdown list for the property data type for this cell
          DropDownList inquiryTypeSelection = new DropDownList();
          inquiryTypeSelection.Width = Unit.Percentage(100);
  
          // Cast it to the propertyDataType enum and do a switch to determine what items to add to the dropdown
          switch ((Altec.Framework.PropertyDataType)Convert.ToInt32(propertyRowToDraw["DataType"]))
          {
              case PropertyDataType.Date:
                  inquiryTypeSelection.Items.Add(new ListItem("Exactly", "2"));
                  inquiryTypeSelection.Items.Add(new ListItem("Greater Then", "3"));
                  inquiryTypeSelection.Items.Add(new ListItem("Less Then", "4"));
                  inquiryTypeSelection.Items.Add(new ListItem("Range", "5"));
                  break;
  
              case PropertyDataType.Boolean:
                  inquiryTypeSelection.Items.Add(new ListItem("Exactly", "2"));
                  break;
  
              case PropertyDataType.Currency:
                  inquiryTypeSelection.Items.Add(new ListItem("Any", "1"));
                  inquiryTypeSelection.Items.Add(new ListItem("All", "0"));
                  inquiryTypeSelection.Items.Add(new ListItem("Greater Then", "3"));
                  inquiryTypeSelection.Items.Add(new ListItem("Less Then", "4"));
                  inquiryTypeSelection.Items.Add(new ListItem("Range", "5"));
                  break;
  
              case PropertyDataType.Double:
                  inquiryTypeSelection.Items.Add(new ListItem("Any", "1"));
                  inquiryTypeSelection.Items.Add(new ListItem("All", "0"));
                  inquiryTypeSelection.Items.Add(new ListItem("Greater Then", "3"));
                  inquiryTypeSelection.Items.Add(new ListItem("Less Then", "4"));
                  inquiryTypeSelection.Items.Add(new ListItem("Range", "5"));
                  break;
  
              case PropertyDataType.String:
                  inquiryTypeSelection.Items.Add(new ListItem("Any", "1"));
                  inquiryTypeSelection.Items.Add(new ListItem("All", "0"));
                  break;
          }
  
          // Add the dropdown to the cell and then add the cell to the row
          propertyDataTypeColumn.Width = Unit.Percentage(15);
          propertyDataTypeColumn.Controls.Add(inquiryTypeSelection);
          propertyRow.Cells.Add(propertyDataTypeColumn);
  
  
          // Create the cell that will hold the input box
          propertyIDColumn = new TableCell();
          propertyIDColumn.ID = "propertyInputColumn" + propertyRowToDraw["PropertyId"].ToString();
  
          // Create the textbox input that will hold the search value for that property row
          TextBox propertyTextInput = new TextBox();
          propertyTextInput.ID = "propertyInputText" + propertyRowToDraw["PropertyId"].ToString();
          propertyIDColumn.Controls.Add(propertyTextInput);
          propertyTextInput.Width = Unit.Percentage(92);
          // Add it to the row
          propertyRow.Cells.Add(propertyIDColumn);
  
          // Add the row to the overall table
          docTypePropertiesTable.Rows.Add(propertyRow);
  
  
      }
  </code></pre>
  
  <p>How would I get the values input into those textboxes (propertyTextInput) on the server side through the updatepanel?  For some reason, the table does not show up in the viewstate when it posts back - even when I force viewstatemode = enabled.  </p>
  
  <p>I have to generate the rows dynamically because there are a variable number of rows based on other input elements on the page.</p>
  
  <p>Fresh out of ideas.</p>