I posed a similar question about this before, and it would seem based on the answers that I received that I can't expect to be able to rely on a radio button's CheckedChanged event to fire in real time.
Am I really stuck with waiting until the form is submitted before that event fires, or can I add client-side (jQuery) code to handle it? If so, how? How can I mix jQuery client code in with my C# server code in a Sharepoint (2010) project?
What I want to be able to do now is to dynamically alter the controls on the page based on decisions made by the user (if they select this radio button, a particular textbox has this set of properties applied, and if the other radio button, a different set of properties). Is this possible?
UPDATE
I create controls and add CheckedChanged events to them like so:
rbUSCitizenOrPermResY = new RadioButton
{
CssClass = "finaff-webform-field-input"//,
//CheckedChanged += new EventHandler(rbUSCitizenOrPermResY_Changed) <= the name 'CheckedChanged' does not exist in the current context
};
rbUSCitizenOrPermResY.CheckedChanged += new EventHandler(rbUSCitizenOrPermResY_Changed);
cellRadioButton1_1.Controls.Add(rbUSCitizenOrPermResY);
The Save button is like so:
Button btnSave = new Button();
btnSave.Text = "Save";
btnSave.Click += new EventHandler(btnSave_Click);
this.Controls.Add(btnSave);
. . .
private void btnSave_Click(object sender, EventArgs e)
{
LiteralControl message = null;
try
{
message = new LiteralControl();
Controls.Add(message);
ConditionallyCreateList();
SaveInputToList();
List<ListColumns> listOfListItems = ReadFromList();
GeneratePDF(listOfListItems);
message.Text = "Saving the data and converting it to a PDF has been successful";
}
catch (Exception ex)
{
message.Text = String.Format("Exception occurred: {0}", ex.Message);
}
}
What is special about the Save button that it fires immediatley when clicked, yet the CheckedChanged event of a RadioButton does not fire (immediately)?
UPDATE 2
This says, "...UpdatePanel control ... by default, this control does not work with these standard SharePoint components..."
So it sounds like using it is trying to shoehorn a lumberjack's foot into a baby booty.
Then what is the preferred method for getting Sharepoint components to update?
UPDATE 3
Theoretically, it seems maybe this will work:
UpdatePanel up = new UpdatePanel();
up.Controls.Add(dynamicTable); // or just add the radio buttons, rather than the entire HtmlTable?
ScriptManager sm = new ScriptManager();
sm.EnablePartialRendering = true;
...I'll find out, I reckon...