Professional Web Applications Themes

RadioButtonList In DataGrid - ASP.NET Data Grid Control

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 ...

  1. #1

    Default 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!
    Greg Wold Guest

  2. #2

    Default Re: RadioButtonList In DataGrid

    On Thu, 24 Jun 2004 12:00:13 -0700, "Greg Wold"
    <anonymousdiscussions.microsoft.com> wrote:

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

    -Adam
    ashelley@inlandkwpp.com Guest

  3. #3

    Default RadioButtonList in Datagrid

    I need some helps with the RadioButtonList in Datagrid. Here is what I
    want to do. I have several columns in my databrid.

    Column one is my survey question.
    Column two has a RadioButtonList with "Yes" or "No", and a textbox with
    initial state set invisible.
    Column three is another RadioButtonList.

    If a user selects "Yes" of the RadioButtonList in column 2, that will
    make the textbox in column 2 visible and set the RadioButtonList in
    column 3 disable in that row. If a user selects "No" of the
    RadioButtonList in column 2, that will make the textbox in column 2
    invisible and enable the RadioButtonList in column 3 in that row.

    How do I do that? thank You!

    Joseph

    josephqlin@gmail.com Guest

Similar Threads

  1. RadioButtonList within DataGrid
    By Mike Chamberlain in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: April 6th, 02:19 PM
  2. RadioButtonList In DataGrid (edited e-mail address)
    By in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: June 24th, 07:17 PM
  3. Retrieving radiobuttonlist from datagrid
    By Shailesh Jannu in forum ASP.NET Building Controls
    Replies: 0
    Last Post: April 30th, 12:24 AM
  4. Datagrid - dynamic radiobuttonlist problems...
    By Michael Christensen in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: October 7th, 08:24 AM
  5. RadioButtonList in Nested DataGrid Problem
    By Bob Hoke in forum ASP.NET General
    Replies: 0
    Last Post: July 11th, 06:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139