locked
How do I dynamically select RadioButtonList? RRS feed

  • Question

  • User1985730269 posted

    Error Message

    Object reference not set to an instance of an object.

    Dim intBoxNumber As Integer
    Dim rbl As RadioButtonList
    
    	For Each drv IN dv
    		intBoxNumber = drv("BoxNumber")
    
    		rbl = DirectCast(FindControl("rblPageSandBox" & intBoxNumber), RadioButtonList)
    		rbl.Items.FindByValue("intPageSandBox" & intBoxNumber).Selected = True
    	Next


    Friday, January 21, 2011 5:36 PM

Answers

  • User336673788 posted

    you need to validate rbl before setting the value.


    if rbl isnot nothing then
       .... set value

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 24, 2011 3:53 PM

All replies

  • User-1171043462 posted

    Where is your RadiobuttonList? On page or panel? 

    Saturday, January 22, 2011 1:43 AM
  • User336673788 posted

    you need to validate rbl before setting the value.


    if rbl isnot nothing then
       .... set value

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 24, 2011 3:53 PM