hey all - this is solved now but I wanted to put this out there in case anyone else bumps into it. It may also be a 'working as designed' thing...
I created a new page and put some radio buttons on it and gave them all the groupname = "ReportGrid". I had also previously created a gridview and gave that an ID = "ReportGrid". My page would load fine but as soon as I selected a radio button, I would
get the 'Object Reference not set to an instance of an object' error. After debugging it for quite a while, I noticed the groupname was the same as the grid's ID so I changed it and then it started working.
I also tested this by changing the groupname to the ID of a textbox and got the same error. However, when setting groupname equal to the ID of a SqlDataSource, it worked fine.... so not sure what's going on with that.
moral of the story - make your groupname unique from everything else.
I don't care if you give me the points...but it would be nice ;-)
Marked as answer by bclaman on Feb 25, 2011 03:54 PM
bclaman
Participant
977 Points
259 Posts
object reference error when radio button groupname same as another control ID
Feb 25, 2011 03:50 PM|LINK
hey all - this is solved now but I wanted to put this out there in case anyone else bumps into it. It may also be a 'working as designed' thing...
I created a new page and put some radio buttons on it and gave them all the groupname = "ReportGrid". I had also previously created a gridview and gave that an ID = "ReportGrid". My page would load fine but as soon as I selected a radio button, I would get the 'Object Reference not set to an instance of an object' error. After debugging it for quite a while, I noticed the groupname was the same as the grid's ID so I changed it and then it started working.
I also tested this by changing the groupname to the ID of a textbox and got the same error. However, when setting groupname equal to the ID of a SqlDataSource, it worked fine.... so not sure what's going on with that.
moral of the story - make your groupname unique from everything else.