RadioButtonList In DataGrid (edited e-mail address)

G

Guest

Hi all!

I have a page that gets a list of users from a database
and puts them into a DataGrid. The DataGrid is editable.

In Edit Mode of the DataGrid, I'll click update w/out
making a selection on a RadioButtonList and get this error:

"Object reference not set to an instance of an object."

Here's the code giving the error:

..Add(New SqlParameter("@ExceptionType", CInt(CType
(e.Item.FindControl("radException"),
RadioButtonList).SelectedItem.Value)))

I think I understand why I'm getting the error: there is
no value for the control.

The real problem is that I have a RequiredFieldValidator
in the EditItemTemplate that doesn't seem to catch
the unselected state of the RadioButtonList.

Here's the code for the validator:

<asp:requiredfieldvalidator id="radException_ReqFldValid"
initialvalue="" controltovalidate="radException"
display="Dynamic" errormessage="Please select an Exception
Type." />

Is this happening because it's in a template and is being
renamed for each user? If so, how do I workaround it?

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top