Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   RadioButtonList In DataGrid (http://www.velocityreviews.com/forums/t760790-radiobuttonlist-in-datagrid.html)

Greg Wold 06-24-2004 07:00 PM

RadioButtonList In DataGrid
 
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!

ashelley@inlandkwpp.com 06-24-2004 07:30 PM

Re: RadioButtonList In DataGrid
 
On Thu, 24 Jun 2004 12:00:13 -0700, "Greg Wold"
<anonymous@discussions.microsoft.com> wrote:

The selected value / selected item will be null if you do not make a
selection.

-Adam


All times are GMT. The time now is 06:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57