Hi all, I was just wondering if anyone can help me on this one. I have a page that dynamically adds controls to a page; its a survey form where the questions...and answers for multiple choice questions...are pulled from a database. Multiple choice questions
are represented as RadioButtonLists. Each multiple choice question has an associated RequiredFieldValidator...and this is where my problem comes in. I tried to submit a page without selecting any option from the RadioButtonList, and indeed, the RFV's fired
displaying the ErrorMessage. However, when I selected a value, the errormessage didn't go away as it normally would. Even more crazy, was that it seemed that some of the RFV's were validating some of the TextBoxes (for free response-type questions): I would
type in a response and the ErrorMessage on one of the RadioButtonLists would disappear. I thought I must have been getting the ControlToValidate property messed up. This is what I did: I set the id of the RadioButtonList to whatever QuestionID was pulled in
from the db i.e. myRadioButtonList.ID = (string)myRow["QuestionID"], where myRow is part of a RowCollection from a DataSet filled with the questions of the survey. Then, I set the ControlToValidate property of the RFV to myRadioButtonList.ID. Seems simple
enough, right? After some tinkering around with trace and looking at the source, I was really confused b/c the RFV's were associated with their respective controls, yet it wasn't working as it should. Then, I set EnableClientSideScript = False on the RFV's,
and everything worked as expected. Any ideas as to why the clientside script was messing up? Jake
Jacob Norbut
Member
260 Points
52 Posts
dynamic radiobuttonlist control validation
Aug 22, 2003 05:15 PM|LINK