Okay this is the code.

The entire form is generated dynamically based a set of customised questions from the database.

It now works sporadically for some options, but not for all of them. And each time I try it, only one or two postback properly whereas on my local machine it all works perfectly:

VB Code:
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Dim ds As Questions
  3.         Dim question As Questions.QuestionsRow
  4.         Dim tablenames(0) As String
  5.         Try
  6.             tablenames(0) = "Questions"
  7.             If Not IsPostBack Then
  8.                 ds = New Questions
  9.                 If PopulateClientData() = False Then
  10.                     'cancel the load because this review has already been completed
  11.                     Exit Sub
  12.                 End If
  13.                 'populate the dataset and store in the session object
  14.                 SqlHelper.FillDataset(connectionString, CommandType.StoredProcedure, "uspGetReviewQuestions", ds, tablenames)
  15.                 Session("Questions") = ds
  16.             Else
  17.                 Response.Write("Postback")
  18.                 ds = CType(Session("Questions"), Questions)
  19.             End If
  20.  
  21.             With pnlReview.Controls
  22.                 'start table creation
  23.                 .Add(New LiteralControl("<TABLE id='Table2' cellSpacing='1' cellPadding='1' width='100%' border='0'>"))
  24.  
  25.                 For Each question In ds.Questions
  26.  
  27.                     'add the first row with the question
  28.                     .Add(New LiteralControl("<TR>"))
  29.                     .Add(New LiteralControl("<TD vAlign='middle' align='left' width='85%'><FONT size='2'><STRONG>"))
  30.                     .Add(New LiteralControl(question.ReviewQuestion))
  31.                     If question.RequiresYesNo = True Then
  32.  
  33.                         'create the rfv
  34.                         rfv = New RequiredFieldValidator
  35.                         rfv.ErrorMessage = "Please select a value for '" & question.ReviewQuestion & "'"
  36.                         rfv.ControlToValidate = "Q" & question.ReviewQuestionID
  37.                         rfv.Text = "*"
  38.                         rfv.Font.Bold = True
  39.                         rfv.ForeColor = errorColor
  40.                         .Add(rfv)
  41.  
  42.                         .Add(New LiteralControl("&nbsp;&nbsp;"))
  43.  
  44.                         lbl = New Label
  45.                         lbl.ForeColor = errorColor
  46.                         lbl.Font.Bold = True
  47.                         lbl.Font.Italic = True
  48.                         lbl.Font.Size = fontSize
  49.                         lbl.Font.Name = "verdana"
  50.                         lbl.Text = "Please specify a reason: "
  51.                         lbl.Visible = False
  52.                         lbl.ID = "L" & question.ReviewQuestionID
  53.                         .Add(lbl)
  54.  
  55.                         .Add(New LiteralControl("</STRONG></FONT></TD>"))
  56.                         .Add(New LiteralControl("<TD vAlign='middle' align='left' width='15%'>"))
  57.                     End If
  58.                     'create the rbl -- always add one to the form, but hide it if requires yes/no = false
  59.                     rbl = New RadioButtonList
  60.                     rbl.ID = "Q" & question.ReviewQuestionID
  61.                     rbl.Items.Add(New ListItem("Yes", 1))
  62.                     rbl.Items.Add(New ListItem("No", 0))
  63.                     rbl.RepeatColumns = 2
  64.                     rbl.RepeatDirection = RepeatDirection.Horizontal
  65.                     rbl.ForeColor = foreColor
  66.                     rbl.Width = New Unit(100, UnitType.Percentage)
  67.                     rbl.Font.Size = fontSize
  68.                     rbl.AutoPostBack = True
  69.                     rbl.Visible = question.RequiresYesNo
  70.                     .Add(rbl)
  71.  
  72.  
  73.                     'if the question requires a reason then add a reason box
  74.                     If question.RequiresReason = True Then
  75.                         'now add the textbox and label on a new row
  76.                         .Add(New LiteralControl("<TR>"))
  77.                         .Add(New LiteralControl("<TD vAlign='middle' align='left' width='85%'>"))
  78.  
  79.                         box = New TextBox
  80.                         box.ID = "R" & question.ReviewQuestionID
  81.                         box.ForeColor = foreColor
  82.                         box.Width = New Unit(97, UnitType.Percentage)
  83.                         box.MaxLength = 250
  84.                         box.BackColor = backColor
  85.                         box.Font.Name = fontName
  86.                         box.Font.Size = fontSize
  87.                         If question.RequiresYesNo = True Then box.Visible = False
  88.                         .Add(box)
  89.  
  90.                         'add an rfv for the text box
  91.                         rfv = New RequiredFieldValidator
  92.                         rfv.ErrorMessage = "Please specify a reason"
  93.                         rfv.ControlToValidate = "R" & question.ReviewQuestionID
  94.                         rfv.Text = "*"
  95.                         rfv.ForeColor = foreColor
  96.                         rfv.Enabled = False
  97.                         .Add(rfv)
  98.  
  99.                         'close the current row
  100.                         .Add(New LiteralControl("<TD>"))
  101.                         .Add(New LiteralControl("<TD align='left' width='15%'></TD>"))
  102.                         .Add(New LiteralControl("</TR>"))
  103.  
  104.                         If question.RequiresYesNo = True Then
  105.                             AddHandler rbl.SelectedIndexChanged, AddressOf ShowHideTextBox
  106.                         Else
  107.                             box.Rows = 2
  108.                             box.TextMode = TextBoxMode.MultiLine
  109.                         End If
  110.                     End If
  111.  
  112.                 Next
  113.  
  114.                 'finally close off the table
  115.                 .Add(New LiteralControl("</TABLE>"))
  116.  
  117.             End With
  118.         Catch ex As Exception
  119.             RedirectError("Error populating annual review." & ex.ToString)
  120.         End Try
  121.     End Sub
  122.  
  123.     Private Sub ShowHideTextBox(ByVal sender As Object, ByVal e As EventArgs)
  124.         Dim rbl As RadioButtonList = CType(sender, RadioButtonList)
  125.         Dim box As TextBox
  126.         Dim ctl As Control
  127.         Dim index As Integer
  128.         Dim lbl As Label
  129.         Dim ds As Questions
  130.         Dim view As DataView
  131.         Dim question As Questions.QuestionsRow
  132.  
  133.         index = Mid(rbl.ID, 2)
  134.  
  135.         For Each ctl In pnlReview.Controls
  136.             If TypeOf ctl Is TextBox Then
  137.                 If ctl.ID = "R" & index Then
  138.                     box = CType(ctl, TextBox)
  139.                 End If
  140.             Else
  141.                 If TypeOf ctl Is Label Then
  142.                     If ctl.ID = "L" & index Then
  143.                         lbl = CType(ctl, Label)
  144.                     End If
  145.                 End If
  146.             End If
  147.         Next
  148.  
  149.  
  150.         'find the question associated with this id
  151.         ds = CType(Session("Questions"), Questions)
  152.  
  153.         view = New DataView(ds.Questions)
  154.         view.RowFilter = ds.Questions.ReviewQuestionIDColumn.ColumnName & " = " & index
  155.  
  156.         If view.Count = 1 Then question = CType(view(0).Row, Questions.QuestionsRow)
  157.  
  158.         If Not IsNothing(question) Then
  159.             If question.JustifyIfYes = True Then
  160.                 If rbl.SelectedValue = 1 Then
  161.                     box.Visible = True
  162.                     lbl.Visible = True
  163.                 Else
  164.                     box.Visible = False
  165.                     lbl.Visible = False
  166.                 End If
  167.             Else
  168.                 If rbl.SelectedValue = 1 Then
  169.                     box.Visible = False
  170.                     lbl.Visible = False
  171.                 Else
  172.                     box.Visible = True
  173.                     lbl.Visible = True
  174.                 End If
  175.             End If
  176.         End If
  177.     End Sub

Any ideas?