RadioButtonList In DataGrid

Discussion in 'ASP .Net Web Controls' started by Greg Wold, Jun 24, 2004.

  1. Greg Wold

    Greg Wold 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!
     
    Greg Wold, Jun 24, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob Hoke
    Replies:
    0
    Views:
    491
    Bob Hoke
    Jul 11, 2003
  2. Mike P

    edit datagrid with radiobuttonlist

    Mike P, Aug 27, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    433
    Mike P
    Aug 27, 2003
  3. DotNetGruven

    RadioButtonList in a DataGrid

    DotNetGruven, Jan 24, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,897
    Steven Cheng[MSFT]
    Jan 28, 2004
  4. DotNetGruven
    Replies:
    6
    Views:
    4,379
    DotNetGruven
    Feb 3, 2004
  5. =?Utf-8?B?U2VyZw==?=

    How to bind DataGrid RadioButtonList's value?

    =?Utf-8?B?U2VyZw==?=, Oct 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,588
    =?Utf-8?B?U2VyZw==?=
    Oct 15, 2004
Loading...

Share This Page